Extend API : add possibility to force use of anonymous gadget


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40558 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a5f6aee7
......@@ -51,7 +51,7 @@
\n
<tal:block metal:define-macro="knowledge_pad_security_check">\n
\n
<div tal:condition="python: not isUserAllowedToCreateKnowledgePads and not isAnon">\n
<div tal:condition="python: not ( isUserAllowedToCreateKnowledgePads or isAnon or isAnonymousKnowledgePadUsed)">\n
<div class="wait_block">\n
<p i18n:translate="" i18n:domain="ui"> \n
You are not allowed to use knowledge pad system due to security restrictions.\n
......
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
......@@ -79,10 +76,11 @@
\n
request = context.REQUEST\n
isAnon = context.portal_membership.isAnonymousUser()\n
isAnonymousKnowledgePadUsed = request.get(\'is_anonymous_knowledge_pad_used\', 0);\n
kw = {\'portal_type\': \'Knowledge Pad\',\n
\'sort_on\': ((\'creation_date\', \'ascending\',),),\n
\'limit\': 50,}\n
if isAnon:\n
if isAnon or isAnonymousKnowledgePadUsed:\n
results = context.knowledge_pad_module.searchFolder(\n
validation_state = (\'public\',),\n
**kw)\n
......@@ -170,6 +168,7 @@ return results\n
<string>context</string>
<string>request</string>
<string>isAnon</string>
<string>isAnonymousKnowledgePadUsed</string>
<string>kw</string>
<string>_apply_</string>
<string>results</string>
......
......@@ -39,7 +39,7 @@
<tal:block \n
tal:repeat="box_id python: options[\'section_layout\']"\n
tal:define="real_context python: options.get(\'real_context\', None);\n
cancel_url python: options.get(\'cancel_url\', None)">\n
cancel_url python: options.get(\'cancel_url\', None);">\n
<tal:block \n
tal:condition="python: getattr(here, box_id, None) is not None"\n
tal:define="box python: getattr(here, box_id);\n
......@@ -64,7 +64,9 @@
test(real_context.getPortalType() in (\'ERP5 Site\', \'Web Site\',),\n
real_context, current_web_section); \n
isKnowledgePadTemplateUsed python:\n
request.get(\'is_knowledge_pad_template_used\', 0);">\n
request.get(\'is_knowledge_pad_template_used\', 0);\n
isAnonymousKnowledgePadUsed python:\n
request.get(\'is_anonymous_knowledge_pad_used\', 0);">\n
\n
<div class="block" \n
tal:condition="python: gadget is not None"\n
......@@ -72,7 +74,7 @@
\n
<h3 class="handle">\n
<span class="handle">\n
<tal:block tal:condition="not: isAnon">\n
<tal:block tal:condition="python: not (isAnon or isAnonymousKnowledgePadUsed)">\n
<a class="clickable-block block-remove" \n
i18n:translate="" \n
i18n:domain="ui"\n
......@@ -101,7 +103,8 @@
\n
<!-- Edit form -->\n
<div class="edit-form" \n
tal:condition="python: not isAnon and edit_form_id is not None and box is not None and not isKnowledgePadTemplateUsed"\n
tal:condition="python: not isAnon and edit_form_id is not None and box is not None and\n
not isAnonymousKnowledgePadUsed and not isKnowledgePadTemplateUsed"\n
tal:attributes="id edit_form_dom_id"\n
style="display: none;">\n
\n
......
......@@ -36,11 +36,11 @@
<key> <string>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
\n
<tal:block \n
tal:define="isAnon python: context.portal_membership.isAnonymousUser();\n
mode python: \'web_section\';\n
tal:define="mode python: \'web_section\';\n
default_pad_group python: options.get(\'default_pad_group\', None);\n
isAnonymousKnowledgePadUsed python: options.get(\'use_anonymous_knowledge_pad\', False);\n
dummy python: request.set(\'is_anonymous_knowledge_pad_used\', isAnonymousKnowledgePadUsed);\n
knowledge_pads python: here.ERP5Site_getKnowledgePadListForUser(\n
mode=mode,\n
default_pad_group=default_pad_group);\n
......@@ -77,7 +77,7 @@
\n
<div class="portal-column" \n
id="portal-column-0"\n
tal:attributes="class python: test(isAnon, \n
tal:attributes="class python: test(isAnon or isAnonymousKnowledgePadUsed, \n
\'portal-column-undraggable\', \n
\'portal-column\')"\n
tal:define="layout active_knowledge_pad/KnowledgePad_getBoxColumnLayout;">\n
......@@ -91,7 +91,7 @@
\n
</tal:block>\n
\n
<div tal:condition="python: not isAnon and\n
<div tal:condition="python: not (isAnon or isAnonymousKnowledgePadUsed) and\n
createDefaultPadForUser and \n
isUserAllowedToCreateKnowledgePads">\n
\n
......
......@@ -37,9 +37,10 @@
<value> <unicode encoding="cdata"><![CDATA[
<tal:block \n
tal:define="isAnon python: context.portal_membership.isAnonymousUser();\n
mode python: \'web_section\';\n
tal:define="mode python: \'web_section\';\n
default_pad_group python: options.get(\'default_pad_group\', None);\n
isAnonymousKnowledgePadUsed python: options.get(\'use_anonymous_knowledge_pad\', False);\n
dummy python: request.set(\'is_anonymous_knowledge_pad_used\', isAnonymousKnowledgePadUsed);\n
knowledge_pads python: here.ERP5Site_getKnowledgePadListForUser(\n
mode=mode,\n
default_pad_group=default_pad_group);\n
......@@ -69,7 +70,7 @@
active_knowledge_pad is not None">\n
<div class="portal-column" \n
id="portal-column-2"\n
tal:attributes="class python: test(isAnon, \n
tal:attributes="class python: test((isAnon or isAnonymousKnowledgePadUsed), \n
\'portal-column-undraggable\', \n
\'portal-column\')"\n
tal:define="layout active_knowledge_pad/KnowledgePad_getBoxColumnLayout;">\n
......
......@@ -37,9 +37,10 @@
<value> <unicode encoding="cdata"><![CDATA[
<tal:block \n
tal:define="isAnon python: context.portal_membership.isAnonymousUser();\n
mode python: \'web_section\';\n
tal:define="mode python: \'web_section\';\n
default_pad_group python: options.get(\'default_pad_group\', None);\n
isAnonymousKnowledgePadUsed python: options.get(\'use_anonymous_knowledge_pad\', False);\n
dummy python: request.set(\'is_anonymous_knowledge_pad_used\', isAnonymousKnowledgePadUsed);\n
knowledge_pads python: here.ERP5Site_getKnowledgePadListForUser(\n
mode=mode,\n
default_pad_group=default_pad_group);\n
......@@ -70,7 +71,7 @@
\n
<div class="portal-column" \n
id="portal-column-1"\n
tal:attributes="class python: test(isAnon, \n
tal:attributes="class python: test((isAnon or isAnonymousKnowledgePadUsed), \n
\'portal-column-undraggable\', \n
\'portal-column\')"\n
tal:define="layout active_knowledge_pad/KnowledgePad_getBoxColumnLayout;">\n
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment