Commit 54cc2b05 authored by Jérome Perrin's avatar Jérome Perrin

Do not fail assigning security to an unowned object.

remove manage_editLocalRolesForm method, we actually use RoleProviderBase.manage_editRolesForm instead.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10612 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a22d2d6c
...@@ -385,7 +385,7 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -385,7 +385,7 @@ class ERP5TypeInformation( FactoryTypeInformation,
# First try to guess from the owner # First try to guess from the owner
try: try:
user_name = ob.getOwnerInfo()['id'] user_name = ob.getOwnerInfo()['id']
except AttributeError: except (AttributeError, TypeError):
pass pass
if user_name is None: if user_name is None:
if ERP5UserManager is not None: if ERP5UserManager is not None:
...@@ -619,22 +619,6 @@ class ERP5TypeInformation( FactoryTypeInformation, ...@@ -619,22 +619,6 @@ class ERP5TypeInformation( FactoryTypeInformation,
_aq_reset() # XXX We should also call it whenever we change workflow defition _aq_reset() # XXX We should also call it whenever we change workflow defition
return result return result
security.declareProtected( Permissions.ManagePortal,
'manage_editLocalRolesForm' )
def manage_editLocalRolesForm( self, REQUEST, manage_tabs_message=None ):
""" Show the 'Local Roles' management tab.
"""
role_list = []
return self._roles_form( self
, REQUEST
, roles=role_list
, possible_permissions=()
, management_view='Roles'
, manage_tabs_message=manage_tabs_message
)
def reorderActions(self, REQUEST=None): def reorderActions(self, REQUEST=None):
"""Reorder actions according to their priorities.""" """Reorder actions according to their priorities."""
new_actions = self._cloneActions() new_actions = self._cloneActions()
......
...@@ -260,8 +260,11 @@ class RoleProviderBase: ...@@ -260,8 +260,11 @@ class RoleProviderBase:
i = 0 i = 0
for brain in portal_catalog(portal_type = self.id): for brain in portal_catalog(portal_type = self.id):
obj = brain.getObject() obj = brain.getObject()
userdb_path, user_id = obj.getOwnerTuple() user_id = None
obj.assignRoleToSecurityGroup(user_name = user_id) owner_tuple = obj.getOwnerTuple()
if owner_tuple is not None:
user_id = owner_tuple[1]
obj.updateLocalRolesOnSecurityGroups(user_name = user_id)
i += 1 i += 1
return self.manage_editRolesForm(REQUEST, manage_tabs_message='%d objects updated' % (i,)) return self.manage_editRolesForm(REQUEST, manage_tabs_message='%d objects updated' % (i,))
......
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