diff --git a/bilean/db/sqlalchemy/api.py b/bilean/db/sqlalchemy/api.py index aab6e25..5adb993 100644 --- a/bilean/db/sqlalchemy/api.py +++ b/bilean/db/sqlalchemy/api.py @@ -123,7 +123,7 @@ def user_get(context, user_id, show_deleted=False, tenant_safe=True): if user is None or user.deleted_at is not None and not deleted_ok: return None - if tenant_safe and context.tenant_id != user.user_id: + if tenant_safe and context.tenant_id != user.id: return None return user diff --git a/bilean/engine/user.py b/bilean/engine/user.py index cb86254..15e5e94 100644 --- a/bilean/engine/user.py +++ b/bilean/engine/user.py @@ -115,6 +115,8 @@ class User(object): def load(cls, context, user_id=None, user=None, realtime=False, show_deleted=False, tenant_safe=True): '''Retrieve a user from database.''' + if context.is_admin: + tenant_safe = False if user is None: user = db_api.user_get(context, user_id, show_deleted=show_deleted,