diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index e0728e16ce512c0fccd14d5470bfddad1e089135..4b842e313d6306ecc55a3e2e89bc67e8e9e5403d 100755 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -40,7 +40,6 @@ from RoleInformation import ori from zLOG import LOG ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT = 'ERP5Type_asSecurityGroupId' -ERP5TYPE_SECURITY_CATEGORY_GENERATION_SCRIPT = 'ERP5Type_getSecurityCategoryFromAssignment' class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): """ @@ -224,12 +223,8 @@ class ERP5TypeInformation( FactoryTypeInformation, RoleProviderBase ): # get the script and apply it if actual_base_category_list is not empty if len(actual_base_category_list) > 0: - if definition['base_category_script']: - base_category_script_id = definition['base_category_script'] - base_category_script = getattr(object, base_category_script_id, None) - else: - base_category_script_id = ERP5TYPE_SECURITY_CATEGORY_GENERATION_SCRIPT - base_category_script = getattr(object, base_category_script_id, None) + base_category_script_id = definition['base_category_script'] + base_category_script = getattr(object, base_category_script_id, None) if base_category_script is not None: # call the script, which should return either a dict or a list of dicts category_result = base_category_script(actual_base_category_list, user_name, object, object.getPortalType()) diff --git a/product/ERP5Type/RoleInformation.py b/product/ERP5Type/RoleInformation.py index 8e699ca5eb05df1affd3fb364a615238becbdc65..6f64323486d55e363a1b9fee763338dbbb9a4f5b 100755 --- a/product/ERP5Type/RoleInformation.py +++ b/product/ERP5Type/RoleInformation.py @@ -28,6 +28,8 @@ from Permissions import ManagePortal from types import StringType +ERP5TYPE_SECURITY_CATEGORY_GENERATION_SCRIPT = 'ERP5Type_getSecurityCategoryFromAssignment' + class RoleInformation( SimpleItem ): """ Represent a single selectable role. @@ -132,7 +134,10 @@ class RoleInformation( SimpleItem ): """ Return the base_category_script id """ - return getattr(self, 'base_category_script', '') + base_category_script = getattr(self, 'base_category_script', '') + if base_category_script: + return base_category_script + return ERP5TYPE_SECURITY_CATEGORY_GENERATION_SCRIPT security.declarePrivate( 'base_category' ) def clone( self ):