Commit 95823b2b authored by Jérome Perrin's avatar Jérome Perrin

ERP5Type/patches/User: BasicUser.allowed

Developer users are exceptional, we should first check if normal user
is allowed before considering Developer role.
parent c0c9898a
......@@ -22,24 +22,6 @@ from ..TransactionalVariable import TransactionalVariable
DEVELOPER_ROLE_ID = 'Developer'
BasicUser_allowed = BasicUser.allowed
def allowed(self, object, object_roles=None):
"""
Check if the user has Developer role which allows to modify ZODB source code
and remove it, as it should never be acquired anyhow, before calling the
original method
"""
# Skip "self._check_context(object)"
if (
object_roles is not _what_not_even_god_should_do and
object_roles is not None and
DEVELOPER_ROLE_ID in set(object_roles or ()).intersection(self.getRoles())
):
return 1
return BasicUser_allowed(self, object, object_roles)
BasicUser.allowed = allowed
SimpleUser_getRoles = SimpleUser.getRoles
def getRoles(self, _transactional_variable_pool=local()):
"""
......
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