mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-23 05:08:32 +00:00
Allow impersonations when checking user_is_admin
This commit is contained in:
parent
fd633f6b52
commit
2063ee42d8
@ -20,8 +20,12 @@ class UserService(object):
|
||||
|
||||
# Returns true if the current user is an admin.
|
||||
@staticmethod
|
||||
def user_is_admin():
|
||||
return UserService.has_user() and g.user.is_admin()
|
||||
def user_is_admin(allow_admin_impersonate=False):
|
||||
if allow_admin_impersonate:
|
||||
user = UserService.current_user(allow_admin_impersonate)
|
||||
else:
|
||||
user = g.user
|
||||
return UserService.has_user() and user.is_admin()
|
||||
|
||||
# Returns true if the current admin user is impersonating another user.
|
||||
@staticmethod
|
||||
|
Loading…
x
Reference in New Issue
Block a user