Commit 6c6a8098 authored by Jérome Perrin's avatar Jérome Perrin

ERP5Type/patches/User: drop BasicUser.allowed patch

This patch does not seem necessary
parent 5dde17a5
...@@ -15,31 +15,12 @@ ...@@ -15,31 +15,12 @@
from threading import local from threading import local
from Acquisition import aq_inner, aq_parent from Acquisition import aq_inner, aq_parent
from AccessControl.PermissionRole import _what_not_even_god_should_do from AccessControl.User import SimpleUser
from AccessControl.User import BasicUser, SimpleUser
from App.config import getConfiguration from App.config import getConfiguration
from ..TransactionalVariable import TransactionalVariable from ..TransactionalVariable import TransactionalVariable
DEVELOPER_ROLE_ID = 'Developer' 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 SimpleUser_getRoles = SimpleUser.getRoles
def getRoles(self, _transactional_variable_pool=local()): 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