[Erp5-report] r14860 - in /erp5/trunk/products/ERP5/bootstrap/erp5_core: ExtensionTemplateI...

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 18 15:55:44 CEST 2007


Author: jp
Date: Mon Jun 18 15:55:44 2007
New Revision: 14860

URL: http://svn.erp5.org?rev=14860&view=rev
Log:
Acquire in categories in security scripts. Added security script to build a security group from self.

Added:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromSelf.xml
Modified:
    erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromContent.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromAssignment.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromContent.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromAssignment.xml
    erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromContent.xml

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py?rev=14860&r1=14859&r2=14860&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/ExtensionTemplateItem/StandardSecurity.py Mon Jun 18 15:55:44 2007
@@ -70,7 +70,7 @@
     if assignment.getValidationState() == 'open':
       category_dict = {}
       for base_category in base_category_list:
-        category_value_list = assignment.getValueList(base_category)
+        category_value_list = assignment.getAcquiredValueList(base_category)
         if category_value_list:
           for category_value in category_value_list:
             if base_category in child_category_list:

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromContent.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromContent.xml?rev=14860&r1=14859&r2=14860&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromContent.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromContent.xml Mon Jun 18 15:55:44 2007
@@ -101,7 +101,7 @@
   return []\n
 \n
 for base_category in base_category_list:\n
-  category_list.append({base_category: object.getCategoryMembershipList(base_category)})\n
+  category_list.append({base_category: object.getAcquiredCategoryMembershipList(base_category)})\n
 \n
 return category_list\n
 </string> </value>

Added: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromSelf.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromSelf.xml?rev=14860&view=auto
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromSelf.xml (added)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityCategoryFromSelf.xml Mon Jun 18 15:55:44 2007
@@ -1,0 +1,186 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PythonScripts.PythonScript</string>
+          <string>PythonScript</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Python_magic</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string>"""\n
+This script returns a list of dictionaries which represent\n
+the security groups which a person is member of. It extracts\n
+the categories from the current content and associates\n
+it to a given base_category. It is useful in the\n
+following cases:\n
+\n
+- calculate a security group based current object \n
+  in the context of a base category (ex. source_project).\n
+  This is used for example in ERP5 DMS to calculate\n
+  project security.\n
+\n
+The parameters are\n
+\n
+  base_category_list -- list of category values we need to retrieve\n
+  user_name          -- string obtained from getSecurityManager().getUser().getId()\n
+  object             -- object which we want to assign roles to\n
+  portal_type        -- portal type of object\n
+\n
+NOTE: for now, this script requires proxy manager\n
+"""\n
+\n
+category_list = []\n
+\n
+if object is None:\n
+  return []\n
+\n
+for base_category in base_category_list:\n
+  category_list.append({base_category: object.getRelativeUrl()})\n
+\n
+return category_list\n
+</string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_filepath</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_owner</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>base_category_list, user_name, object, portal_type</string> </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>4</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>base_category_list</string>
+                            <string>user_name</string>
+                            <string>object</string>
+                            <string>portal_type</string>
+                            <string>category_list</string>
+                            <string>None</string>
+                            <string>_getiter_</string>
+                            <string>base_category</string>
+                            <string>_getattr_</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>ERP5Type_getSecurityCategoryFromSelf</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromAssignment.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromAssignment.xml?rev=14860&r1=14859&r2=14860&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromAssignment.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromAssignment.xml Mon Jun 18 15:55:44 2007
@@ -117,7 +117,7 @@
   if assignment.getValidationState() == \'open\':\n
     category_dict = {}\n
     for base_category in base_category_list:\n
-      category_value_list = assignment.getValueList(base_category)\n
+      category_value_list = assignment.getAcquiredValueList(base_category)\n
       if category_value_list:\n
         for category_value in category_value_list:\n
           category_dict.setdefault(base_category, []).append(\'%s*\' % category_value.getRelativeUrl())\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromContent.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromContent.xml?rev=14860&r1=14859&r2=14860&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromContent.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityChildCategoryFromContent.xml Mon Jun 18 15:55:44 2007
@@ -101,7 +101,7 @@
   return []\n
 \n
 for base_category in base_category_list:\n
-  membership_list = map(lambda x: \'%s*\' % x, object.getCategoryMembershipList(base_category))\n
+  membership_list = map(lambda x: \'%s*\' % x, object.getAcquiredCategoryMembershipList(base_category))\n
   category_list.append({base_category: membership_list})\n
 \n
 return category_list\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromAssignment.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromAssignment.xml?rev=14860&r1=14859&r2=14860&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromAssignment.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromAssignment.xml Mon Jun 18 15:55:44 2007
@@ -117,7 +117,7 @@
   if assignment.getValidationState() == \'open\':\n
     category_dict = {}\n
     for base_category in base_category_list:\n
-      category_value_list = assignment.getValueList(base_category)\n
+      category_value_list = assignment.getAcquiredValueList(base_category)\n
       if category_value_list:\n
         for category_value in category_value_list:\n
           if category_value.getPortalType() == \'Category\':\n

Modified: erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromContent.xml
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromContent.xml?rev=14860&r1=14859&r2=14860&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromContent.xml (original)
+++ erp5/trunk/products/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Type_getSecurityParentCategoryFromContent.xml Mon Jun 18 15:55:44 2007
@@ -103,7 +103,7 @@
 # Consider all parents of all categories\n
 for base_category in base_category_list:\n
   member_list = []\n
-  for category in object.getValueList(base_category):\n
+  for category in object.getAcquiredValueList(base_category):\n
     if category.getPortalType() == \'Category\':\n
       while category.getPortalType() == \'Category\':\n
         member_list.append(category.getRelativeUrl())\n




More information about the Erp5-report mailing list