diff options
| author | Frederick Muriuki Muriithi | 2026-08-31 14:34:39 -0500 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2026-08-31 14:34:39 -0500 |
| commit | 983085de3eb298c8629285ed111536c119c416a7 (patch) | |
| tree | 340da965d9aaa30dd0c311f0595c1fe52b244219 /gn_auth | |
| parent | 39e1178350ade05d75c2d13232f85b8ae17690c1 (diff) | |
| download | gn-auth-983085de3eb298c8629285ed111536c119c416a7.tar.gz | |
Use `gn_libs.sqlite3 instead of deprecated `gn_auth.auth.db.sqlite3`.
Diffstat (limited to 'gn_auth')
| -rw-r--r-- | gn_auth/auth/authorisation/resources/common.py | 2 | ||||
| -rw-r--r-- | gn_auth/auth/authorisation/resources/models.py | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/gn_auth/auth/authorisation/resources/common.py b/gn_auth/auth/authorisation/resources/common.py index 0c12fe1..13a0c87 100644 --- a/gn_auth/auth/authorisation/resources/common.py +++ b/gn_auth/auth/authorisation/resources/common.py @@ -1,7 +1,7 @@ """Utilities common to more than one resource.""" import uuid -from gn_auth.auth.db import sqlite3 as db +from gn_libs import sqlite3 as db def assign_resource_owner_role( cursor: db.DbCursor, diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py index 27ef183..5762551 100644 --- a/gn_auth/auth/authorisation/resources/models.py +++ b/gn_auth/auth/authorisation/resources/models.py @@ -6,10 +6,12 @@ from uuid import UUID, uuid4 from functools import reduce, partial from typing import Dict, Union, Sequence, Optional +from flask import current_app as app + from gn_libs import sqlite3 as db +from gn_libs.sqlite3 import with_db_connection from gn_auth.auth.authentication.users import User -from gn_auth.auth.db.sqlite3 import with_db_connection from gn_auth.auth.authorisation.roles import Role from gn_auth.auth.authorisation.privileges import Privilege @@ -335,8 +337,9 @@ def link_data_to_resource( raise AuthorisationError( "You are not authorised to link/unlink data to this resource.") - resource = with_db_connection(partial( - resource_by_id, user=user, resource_id=resource_id)) + resource = with_db_connection( + app.config["AUTH_DB"], + partial(resource_by_id, user=user, resource_id=resource_id)) return {# type: ignore[operator] "mrna": mrna_link_data_to_resource, "genotype": genotype_link_data_to_resource, @@ -350,8 +353,9 @@ def unlink_data_from_resource( raise AuthorisationError( "You are not authorised to link/unlink data this resource.") - resource = with_db_connection(partial( - resource_by_id, user=user, resource_id=resource_id)) + resource = with_db_connection( + app.config["AUTH_DB"], + partial(resource_by_id, user=user, resource_id=resource_id)) dataset_type = resource.resource_category.resource_category_key return { "mrna": mrna_unlink_data_from_resource, |
