aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-10-12 10:18:05 +0300
committerFrederick Muriuki Muriithi2023-10-12 10:18:05 +0300
commitfc3287d7ad66e0b1551b3c1e5e4d55918cfdcc12 (patch)
treee41e4bcc122c5776f9b30e8c3e6de3025ccfd81c /gn_auth/auth/authorisation
parent07bb9c09533e97b4883b21f09a9bdd03cd94ff42 (diff)
downloadgn-auth-fc3287d7ad66e0b1551b3c1e5e4d55918cfdcc12.tar.gz
Bugs: Fix query and provide default function for inbredset-group
Diffstat (limited to 'gn_auth/auth/authorisation')
-rw-r--r--gn_auth/auth/authorisation/resources/models.py3
-rw-r--r--gn_auth/auth/authorisation/users/models.py8
2 files changed, 6 insertions, 5 deletions
diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py
index 25ae0fd..a9d1378 100644
--- a/gn_auth/auth/authorisation/resources/models.py
+++ b/gn_auth/auth/authorisation/resources/models.py
@@ -291,7 +291,8 @@ def attach_resources_data(
"genotype": genotype_attach_resources_data,
"phenotype": phenotype_attach_resources_data,
"system": lambda *args: [],
- "group": lambda *args: []
+ "group": lambda *args: [],
+ "inbredset-group": lambda *args: []
}
organised = organise_resources_by_category(resources)
with db.cursor(conn) as cursor:
diff --git a/gn_auth/auth/authorisation/users/models.py b/gn_auth/auth/authorisation/users/models.py
index 9fb9d9e..8b47fc1 100644
--- a/gn_auth/auth/authorisation/users/models.py
+++ b/gn_auth/auth/authorisation/users/models.py
@@ -52,15 +52,15 @@ def user_resource_roles(conn: db.DbConnection, user: User) -> dict[uuid.UUID, tu
cursor.execute(
"SELECT res.*, rls.*, p.*"
"FROM resources AS res INNER JOIN "
- "group_user_roles_on_resources AS guror "
- "ON res.resource_id=guror.resource_id "
+ "user_roles AS ur "
+ "ON res.resource_id=ur.resource_id "
"LEFT JOIN roles AS rls "
- "ON guror.role_id=rls.role_id "
+ "ON ur.role_id=rls.role_id "
"LEFT JOIN role_privileges AS rp "
"ON rls.role_id=rp.role_id "
"LEFT JOIN privileges AS p "
"ON rp.privilege_id=p.privilege_id "
- "WHERE guror.user_id = ?",
+ "WHERE ur.user_id = ?",
(str(user.user_id),))
return __build_resource_roles__(
(dict(row) for row in cursor.fetchall()))