From e19b01571ce61e01f482a1dadeeb2fd835fda939 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 14 Sep 2023 12:06:23 +0300 Subject: Move `groups` package under `resources` package With user groups being resources that users can act on (with the recent changes), this commit moves the `groups` module to under the `resources` module. It also renames the `*_resources.py` modules by dropping the `_resources` part since the code is under the `resources` module anyway. --- gn_auth/auth/authorisation/data/genotypes.py | 10 +++++----- gn_auth/auth/authorisation/data/mrna.py | 10 +++++----- gn_auth/auth/authorisation/data/phenotypes.py | 11 +++++------ gn_auth/auth/authorisation/data/views.py | 4 ++-- 4 files changed, 17 insertions(+), 18 deletions(-) (limited to 'gn_auth/auth/authorisation/data') diff --git a/gn_auth/auth/authorisation/data/genotypes.py b/gn_auth/auth/authorisation/data/genotypes.py index 818f72d..bfddfc1 100644 --- a/gn_auth/auth/authorisation/data/genotypes.py +++ b/gn_auth/auth/authorisation/data/genotypes.py @@ -4,12 +4,12 @@ from typing import Iterable from MySQLdb.cursors import DictCursor -from ..checks import authorised_p -from ..groups.models import Group +from gn_auth.auth.dictify import dictify +from gn_auth.auth.db import mariadb as gn3db +from gn_auth.auth.db import sqlite3 as authdb -from ...dictify import dictify -from ...db import mariadb as gn3db -from ...db import sqlite3 as authdb +from gn_auth.auth.authorisation.checks import authorised_p +from gn_auth.auth.authorisation.resources.groups.models import Group def linked_genotype_data(conn: authdb.DbConnection) -> Iterable[dict]: """Retrive genotype data that is linked to user groups.""" diff --git a/gn_auth/auth/authorisation/data/mrna.py b/gn_auth/auth/authorisation/data/mrna.py index 53f9bf9..edcd29e 100644 --- a/gn_auth/auth/authorisation/data/mrna.py +++ b/gn_auth/auth/authorisation/data/mrna.py @@ -3,12 +3,12 @@ import uuid from typing import Iterable from MySQLdb.cursors import DictCursor -from ..checks import authorised_p -from ..groups.models import Group +from gn_auth.auth.dictify import dictify +from gn_auth.auth.db import sqlite3 as authdb +from gn_auth.auth.db import mariadb as gn3db -from ...dictify import dictify -from ...db import sqlite3 as authdb -from ...db import mariadb as gn3db +from gn_auth.auth.authorisation.checks import authorised_p +from gn_auth.auth.authorisation.resources.groups.models import Group def linked_mrna_data(conn: authdb.DbConnection) -> Iterable[dict]: """Retrieve mRNA Assay data that is linked to user groups.""" diff --git a/gn_auth/auth/authorisation/data/phenotypes.py b/gn_auth/auth/authorisation/data/phenotypes.py index 84fc089..17555ec 100644 --- a/gn_auth/auth/authorisation/data/phenotypes.py +++ b/gn_auth/auth/authorisation/data/phenotypes.py @@ -4,13 +4,12 @@ from typing import Any, Iterable from MySQLdb.cursors import DictCursor +from gn_auth.auth.dictify import dictify +from gn_auth.auth.db import sqlite3 as authdb +from gn_auth.auth.db import mariadb as gn3db -from ..checks import authorised_p -from ..groups.models import Group - -from ...dictify import dictify -from ...db import sqlite3 as authdb -from ...db import mariadb as gn3db +from gn_auth.auth.authorisation.checks import authorised_p +from gn_auth.auth.authorisation.resources.groups.models import Group def linked_phenotype_data( authconn: authdb.DbConnection, gn3conn: gn3db.DbConnection, diff --git a/gn_auth/auth/authorisation/data/views.py b/gn_auth/auth/authorisation/data/views.py index 3c49ae5..a674ab4 100644 --- a/gn_auth/auth/authorisation/data/views.py +++ b/gn_auth/auth/authorisation/data/views.py @@ -13,6 +13,8 @@ from flask import request, jsonify, Response, Blueprint, current_app as app from gn_auth import jobs from gn_auth.commands import run_async_cmd +from gn_auth.auth.authorisation.resources.groups.models import group_by_id + from ...db import sqlite3 as db from ...db import mariadb as gn3db from ...db.sqlite3 import with_db_connection @@ -20,8 +22,6 @@ from ...db.sqlite3 import with_db_connection from ..checks import require_json from ..errors import InvalidData, NotFoundError -from ..groups.models import group_by_id - from ..users.models import user_resource_roles from ..resources.checks import authorised_for -- cgit v1.2.3