summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plone/api/env.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plone/api/env.py b/src/plone/api/env.py
index fb18122..ce8652c 100644
--- a/src/plone/api/env.py
+++ b/src/plone/api/env.py
@@ -39,7 +39,10 @@ def adopt_user(username=None, user=None):
acl_users = portal.get().acl_users
unwrapped = acl_users.getUser(username)
if unwrapped is None:
- raise UserNotFoundError
+ acl_users = portal.get().unrestrictedTraverse('/').acl_users
+ unwrapped = acl_users.getUser(username)
+ if unwrapped is None:
+ raise UserNotFoundError
# ZopeSecurityPolicy appears to strongly expect the user object to
# be Acquisition-wrapped in the acl_users from which it was taken.