Commit 1c4df0bd authored by Romain Courteaud's avatar Romain Courteaud

It is not possible to get an user folder from special user (like anonymous).

So, do not wrap the super_user and do not try to get list of roles.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19091 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b44816f6
...@@ -67,17 +67,17 @@ class UnrestrictedMethod(object): ...@@ -67,17 +67,17 @@ class UnrestrictedMethod(object):
def __call__(self, *args, **kw): def __call__(self, *args, **kw):
security_manager = getSecurityManager() security_manager = getSecurityManager()
user = security_manager.getUser() user = security_manager.getUser()
uf = user.aq_inner.aq_parent
# XXX is it better to get roles from the parent (i.e. portal)?
role_list = uf.valid_roles()
if user.getId() is None: if user.getId() is None:
# This is a special user, thus the user is not allowed to own objects. # This is a special user, thus the user is not allowed to own objects.
super_user = UnrestrictedUser(user.getUserName(), None, super_user = UnrestrictedUser(user.getUserName(), None,
role_list, user.getDomains()) user.getRoles(), user.getDomains())
else: else:
uf = user.aq_inner.aq_parent
# XXX is it better to get roles from the parent (i.e. portal)?
role_list = uf.valid_roles()
super_user = PrivilegedUser(user.getId(), None, super_user = PrivilegedUser(user.getId(), None,
role_list, user.getDomains()) role_list, user.getDomains()).__of__(uf)
newSecurityManager(None, super_user.__of__(uf)) newSecurityManager(None, super_user)
try: try:
return self._m(*args, **kw) return self._m(*args, **kw)
finally: finally:
......
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