[gen] Bugfix in the 'change user id' function. Now, the method browses every object in the database and updates local roles where the old ID was potentially mentioned.
This commit is contained in:
parent
7e31304c30
commit
a0837a758f
2 changed files with 41 additions and 8 deletions
|
@ -939,6 +939,19 @@ class BaseMixin:
|
|||
self.reindex()
|
||||
return updated
|
||||
|
||||
def applyUserIdChange(self, oldId, newId):
|
||||
'''A user whose ID was p_oldId has now p_newId. If the old ID was
|
||||
mentioned in self's local roles, update it to the new ID. This
|
||||
method returns 1 if a change occurred, 0 else.'''
|
||||
if oldId in self.__ac_local_roles__:
|
||||
localRoles = self.__ac_local_roles__.copy()
|
||||
localRoles[newId] = localRoles[oldId]
|
||||
del localRoles[oldId]
|
||||
self.__ac_local_roles__ = localRoles
|
||||
self.reindex()
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def hasHistory(self):
|
||||
'''Has this object an history?'''
|
||||
if hasattr(self.aq_base, 'workflow_history') and self.workflow_history:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue