Commit f5d8b5d8 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Override setReference to apply a different permission and to prevent duplicated user ids.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6124 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c0d1d2f5
......@@ -141,3 +141,19 @@ class Person(Entity, Node, XMLObject):
"""
self._setLastName(value)
self.reindexObject()
security.declareProtected('Manage users', 'setReference')
def setReference(self, value):
"""
Set the user id. This method is defined explicitly, because:
- we want to apply a different permission
- we want to prevent duplicated user ids
"""
if value:
user_list = self.acl_users.searchUsers(id = value, exact_match = True)
if len(user_list) > 0:
raise RuntimeError, 'user id %s already exist' % (value,)
self._setReference(value)
self.reindexObject()
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