[Erp5-report] r12546 - /erp5/trunk/products/ERP5Type/RoleInformation.py

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Feb 4 16:12:22 CET 2007


Author: jerome
Date: Sun Feb  4 16:12:19 2007
New Revision: 12546

URL: http://svn.erp5.org?rev=12546&view=rev
Log:
consistant security declarations
fix documentation
cleanups


Modified:
    erp5/trunk/products/ERP5Type/RoleInformation.py

Modified: erp5/trunk/products/ERP5Type/RoleInformation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/RoleInformation.py?rev=12546&r1=12545&r2=12546&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/RoleInformation.py (original)
+++ erp5/trunk/products/ERP5Type/RoleInformation.py Sun Feb  4 16:12:19 2007
@@ -15,7 +15,7 @@
 $Id$
 """
 
-from AccessControl import ClassSecurityInfo, getSecurityManager
+from AccessControl import ClassSecurityInfo
 from Globals import InitializeClass
 from Acquisition import aq_inner, aq_parent
 from OFS.SimpleItem import SimpleItem
@@ -24,18 +24,16 @@
 from Products.CMFCore.Expression import Expression
 
 from Permissions import View
-from Permissions import ManagePortal
 
-from types import StringType
-
-ERP5TYPE_SECURITY_CATEGORY_GENERATION_SCRIPT = 'ERP5Type_getSecurityCategoryFromAssignment'
+ERP5TYPE_SECURITY_CATEGORY_GENERATION_SCRIPT = \
+                'ERP5Type_getSecurityCategoryFromAssignment'
 
 class RoleInformation( SimpleItem ):
 
-    """ Represent a single selectable role.
+    """ Represent a role definition.
 
-    Roles generate links to views of content, or to specific methods
-    of the site.  They can be filtered via their conditions.
+    Roles definitions defines local roles on ERP5Type documents. They are
+    applied by the updateLocalRolesOnSecurityGroups method.
     """
     _isRoleInformation = 1
     __allow_access_to_unprotected_subobjects__ = 1
@@ -90,7 +88,7 @@
         else:
             return 1
 
-    security.declarePublic( 'getRole' )
+    security.declareProtected( View, 'getRole' )
     def getRole( self, ec ):
 
         """ Compute the role using context, 'ec'; return a mapping of
@@ -105,14 +103,14 @@
         info['base_category_script'] = self.getBaseCategoryScript()
         return info
 
-    security.declarePublic( 'getCondition' )
+    security.declareProtected( View, 'getCondition' )
     def getCondition(self):
 
         """ Return the text of the TALES expression for our condition.
         """
         return getattr( self, 'condition', None ) and self.condition.text or ''
 
-    security.declarePublic( 'getCategory' )
+    security.declareProtected( View, 'getCategory' )
     def getCategory( self ):
 
         """ Return the category
@@ -120,9 +118,10 @@
 
             Strip any return or ending space
         """
-        return tuple(map(lambda x: x.strip(), filter(lambda x: x, self.category))) or ()
+        return tuple(map(lambda x: x.strip(),
+                         filter(lambda x: x, self.category))) or ()
 
-    security.declarePublic( 'getBaseCategory' )
+    security.declareProtected( View, 'getBaseCategory' )
     def getBaseCategory( self ):
 
         """ Return the base_category
@@ -130,7 +129,7 @@
         """
         return tuple(getattr(self, 'base_category', ()))
 
-    security.declarePublic( 'getBaseCategoryScript' )
+    security.declareProtected( View, 'getBaseCategoryScript' )
     def getBaseCategoryScript( self ):
 
         """ Return the base_category_script id
@@ -140,7 +139,7 @@
           return base_category_script
         return ERP5TYPE_SECURITY_CATEGORY_GENERATION_SCRIPT
 
-    security.declarePrivate( 'base_category' )
+    security.declarePrivate( 'clone' )
     def clone( self ):
 
         """ Return a newly-created RI just like us.
@@ -152,7 +151,8 @@
                              , condition=self.getCondition()
                              , priority =self.priority
                              , base_category=self.base_category
-                             , base_category_script=getattr(self, 'base_category_script', '')
+                             , base_category_script=getattr(self,
+                                                   'base_category_script', '')
                              )
 
 InitializeClass( RoleInformation )




More information about the Erp5-report mailing list