about summary refs log tree commit diff
path: root/gn_auth/auth/authorisation/data
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth/auth/authorisation/data')
-rw-r--r--gn_auth/auth/authorisation/data/phenotypes.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/gn_auth/auth/authorisation/data/phenotypes.py b/gn_auth/auth/authorisation/data/phenotypes.py
index 92cbe89..08d225d 100644
--- a/gn_auth/auth/authorisation/data/phenotypes.py
+++ b/gn_auth/auth/authorisation/data/phenotypes.py
@@ -18,8 +18,9 @@ from gn_auth.auth.authorisation.resources.system.models import system_resource
 from gn_auth.auth.authorisation.resources.groups.models import Group, group_resource
 
 
+from gn_auth.auth.authentication.users import User
 from gn_auth.auth.authorisation.checks import require_json
-from gn_auth.auth.authorisation.resources.checks import authorised_for2
+from gn_auth.auth.authorisation.resources.checks import authorised_for_spec
 
 logger = logging.getLogger(__name__)
 phenosbp = Blueprint("phenotypes", __name__)
@@ -92,20 +93,22 @@ def pheno_traits_from_db(gn3conn: gn3db.Connection, params: tuple[dict, ...]) ->
 
 def link_phenotype_data(
         authconn: authdb.DbConnection,
-        user,
+        user: User,
         group: Group,
         traits: tuple[dict, ...]
 ) -> dict:
     """Link phenotype traits to a user group."""
-    if not (authorised_for2(authconn,
-                            user,
-                            system_resource(authconn),
-                            ("system:data:link-to-group",))
+    if not (authorised_for_spec(
+                authconn,
+                user.user_id,
+                system_resource(authconn).resource_id,
+                "system:data:link-to-group")
             or
-            authorised_for2(authconn,
-                            user,
-                            group_resource(authconn, group.group_id),
-                            ("group:data:link-to-group",))
+            authorised_for_spec(
+                authconn,
+                user.user_id,
+                group_resource(authconn, group.group_id).resource_id,
+                "group:data:link-to-group")
             ):
         raise AuthorisationError(
             "You do not have sufficient privileges to link data to group "