aboutsummaryrefslogtreecommitdiff
path: root/gn_auth
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-11-13 06:52:00 +0300
committerFrederick Muriuki Muriithi2023-11-13 06:52:00 +0300
commit7d05bb6dac6a57cdeabb31800e248394c12f6cee (patch)
tree5abee65e4ae78646763c95e081856c6cd72feb57 /gn_auth
parent195c07df02a065820ca24d17d455b71851f6c854 (diff)
downloadgn-auth-7d05bb6dac6a57cdeabb31800e248394c12f6cee.tar.gz
Update check for admins
Diffstat (limited to 'gn_auth')
-rw-r--r--gn_auth/auth/authorisation/users/admin/ui.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/gn_auth/auth/authorisation/users/admin/ui.py b/gn_auth/auth/authorisation/users/admin/ui.py
index 68e1ba5..64e79a0 100644
--- a/gn_auth/auth/authorisation/users/admin/ui.py
+++ b/gn_auth/auth/authorisation/users/admin/ui.py
@@ -3,12 +3,12 @@ from functools import wraps
from flask import flash, url_for, redirect
from gn_auth.session import logged_in, session_user, clear_session_info
+from gn_auth.auth.authorisation.resources.system.models import (
+ user_roles_on_system)
from ....authentication.users import User
from ....db.sqlite3 import with_db_connection
-from ...roles.models import user_roles
-
def is_admin(func):
"""Verify user is a system admin."""
@wraps(func)
@@ -16,7 +16,7 @@ def is_admin(func):
def __admin__(*args, **kwargs):
admin_roles = [
role for role in with_db_connection(
- lambda conn: user_roles(
+ lambda conn: user_roles_on_system(
conn, User(**session_user())))
if role.role_name == "system-administrator"]
if len(admin_roles) > 0: