aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-08-07 07:19:16 +0300
committerFrederick Muriuki Muriithi2023-08-07 09:26:11 +0300
commitc9f35e54d5d894051ceb446d1dce54915dcb20f6 (patch)
treec2bfc7bd6b7feab4b7418770f05e7d6ab43623da /gn_auth/auth/authorisation
parentb7f5cd0d788748559ca5e9768f3ea35d45442ef6 (diff)
downloadgn-auth-c9f35e54d5d894051ceb446d1dce54915dcb20f6.tar.gz
Update module name/path
Change from gn3 to gn_auth
Diffstat (limited to 'gn_auth/auth/authorisation')
-rw-r--r--gn_auth/auth/authorisation/data/genotypes.py10
-rw-r--r--gn_auth/auth/authorisation/data/mrna.py10
-rw-r--r--gn_auth/auth/authorisation/data/phenotypes.py10
-rw-r--r--gn_auth/auth/authorisation/data/views.py34
-rw-r--r--gn_auth/auth/authorisation/groups/data.py10
-rw-r--r--gn_auth/auth/authorisation/groups/models.py6
-rw-r--r--gn_auth/auth/authorisation/groups/views.py8
-rw-r--r--gn_auth/auth/authorisation/resources/checks.py4
-rw-r--r--gn_auth/auth/authorisation/resources/models.py8
-rw-r--r--gn_auth/auth/authorisation/resources/views.py2
-rw-r--r--gn_auth/auth/authorisation/roles/models.py8
-rw-r--r--gn_auth/auth/authorisation/roles/views.py4
-rw-r--r--gn_auth/auth/authorisation/users/admin/ui.py8
-rw-r--r--gn_auth/auth/authorisation/users/admin/views.py10
-rw-r--r--gn_auth/auth/authorisation/users/collections/models.py2
-rw-r--r--gn_auth/auth/authorisation/users/collections/views.py12
-rw-r--r--gn_auth/auth/authorisation/users/masquerade/models.py10
-rw-r--r--gn_auth/auth/authorisation/users/masquerade/views.py10
-rw-r--r--gn_auth/auth/authorisation/users/models.py10
-rw-r--r--gn_auth/auth/authorisation/users/views.py6
20 files changed, 91 insertions, 91 deletions
diff --git a/gn_auth/auth/authorisation/data/genotypes.py b/gn_auth/auth/authorisation/data/genotypes.py
index 8f901a5..41822a1 100644
--- a/gn_auth/auth/authorisation/data/genotypes.py
+++ b/gn_auth/auth/authorisation/data/genotypes.py
@@ -4,11 +4,11 @@ from typing import Iterable
from MySQLdb.cursors import DictCursor
-import gn3.auth.db as authdb
-import gn3.db_utils as gn3db
-from gn3.auth.dictify import dictify
-from gn3.auth.authorisation.checks import authorised_p
-from gn3.auth.authorisation.groups.models import Group
+import gn_auth.auth.db as authdb
+import gn_auth.db_utils as gn3db
+from gn_auth.auth.dictify import dictify
+from gn_auth.auth.authorisation.checks import authorised_p
+from gn_auth.auth.authorisation.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 bdfc5c1..0b08571 100644
--- a/gn_auth/auth/authorisation/data/mrna.py
+++ b/gn_auth/auth/authorisation/data/mrna.py
@@ -3,11 +3,11 @@ import uuid
from typing import Iterable
from MySQLdb.cursors import DictCursor
-import gn3.auth.db as authdb
-import gn3.db_utils as gn3db
-from gn3.auth.dictify import dictify
-from gn3.auth.authorisation.checks import authorised_p
-from gn3.auth.authorisation.groups.models import Group
+import gn_auth.auth.db as authdb
+import gn_auth.db_utils as gn3db
+from gn_auth.auth.dictify import dictify
+from gn_auth.auth.authorisation.checks import authorised_p
+from gn_auth.auth.authorisation.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 ff98295..2f4c564 100644
--- a/gn_auth/auth/authorisation/data/phenotypes.py
+++ b/gn_auth/auth/authorisation/data/phenotypes.py
@@ -4,11 +4,11 @@ from typing import Any, Iterable
from MySQLdb.cursors import DictCursor
-import gn3.auth.db as authdb
-import gn3.db_utils as gn3db
-from gn3.auth.dictify import dictify
-from gn3.auth.authorisation.checks import authorised_p
-from gn3.auth.authorisation.groups.models import Group
+import gn_auth.auth.db as authdb
+import gn_auth.db_utils as gn3db
+from gn_auth.auth.dictify import dictify
+from gn_auth.auth.authorisation.checks import authorised_p
+from gn_auth.auth.authorisation.groups.models import Group
def linked_phenotype_data(
authconn: authdb.DbConnection, gn3conn: gn3db.Connection,
diff --git a/gn_auth/auth/authorisation/data/views.py b/gn_auth/auth/authorisation/data/views.py
index 8adf862..a25e9a2 100644
--- a/gn_auth/auth/authorisation/data/views.py
+++ b/gn_auth/auth/authorisation/data/views.py
@@ -10,31 +10,31 @@ from MySQLdb.cursors import DictCursor
from authlib.integrations.flask_oauth2.errors import _HTTPException
from flask import request, jsonify, Response, Blueprint, current_app as app
-import gn3.db_utils as gn3db
-from gn3 import jobs
-from gn3.commands import run_async_cmd
-from gn3.db.traits import build_trait_name
+import gn_auth.db_utils as gn3db
+from gn_auth import jobs
+from gn_auth.commands import run_async_cmd
+from gn_auth.db.traits import build_trait_name
-from gn3.auth import db
-from gn3.auth.db_utils import with_db_connection
+from gn_auth.auth import db
+from gn_auth.auth.db_utils import with_db_connection
-from gn3.auth.authorisation.checks import require_json
-from gn3.auth.authorisation.errors import InvalidData, NotFoundError
+from gn_auth.auth.authorisation.checks import require_json
+from gn_auth.auth.authorisation.errors import InvalidData, NotFoundError
-from gn3.auth.authorisation.groups.models import group_by_id
+from gn_auth.auth.authorisation.groups.models import group_by_id
-from gn3.auth.authorisation.users.models import user_resource_roles
+from gn_auth.auth.authorisation.users.models import user_resource_roles
-from gn3.auth.authorisation.resources.checks import authorised_for
-from gn3.auth.authorisation.resources.models import (
+from gn_auth.auth.authorisation.resources.checks import authorised_for
+from gn_auth.auth.authorisation.resources.models import (
user_resources, public_resources, attach_resources_data)
-from gn3.auth.authentication.users import User
-from gn3.auth.authentication.oauth2.resource_server import require_oauth
+from gn_auth.auth.authentication.users import User
+from gn_auth.auth.authentication.oauth2.resource_server import require_oauth
-from gn3.auth.authorisation.data.phenotypes import link_phenotype_data
-from gn3.auth.authorisation.data.mrna import link_mrna_data, ungrouped_mrna_data
-from gn3.auth.authorisation.data.genotypes import (
+from gn_auth.auth.authorisation.data.phenotypes import link_phenotype_data
+from gn_auth.auth.authorisation.data.mrna import link_mrna_data, ungrouped_mrna_data
+from gn_auth.auth.authorisation.data.genotypes import (
link_genotype_data, ungrouped_genotype_data)
data = Blueprint("data", __name__)
diff --git a/gn_auth/auth/authorisation/groups/data.py b/gn_auth/auth/authorisation/groups/data.py
index ee6f70e..d05747b 100644
--- a/gn_auth/auth/authorisation/groups/data.py
+++ b/gn_auth/auth/authorisation/groups/data.py
@@ -1,11 +1,11 @@
"""Handles the resource objects' data."""
from MySQLdb.cursors import DictCursor
-from gn3 import db_utils as gn3db
-from gn3.auth import db as authdb
-from gn3.auth.authorisation.groups import Group
-from gn3.auth.authorisation.checks import authorised_p
-from gn3.auth.authorisation.errors import NotFoundError
+from gn_auth import db_utils as gn3db
+from gn_auth.auth import db as authdb
+from gn_auth.auth.authorisation.groups import Group
+from gn_auth.auth.authorisation.checks import authorised_p
+from gn_auth.auth.authorisation.errors import NotFoundError
def __fetch_mrna_data_by_ids__(
conn: gn3db.Connection, dataset_ids: tuple[str, ...]) -> tuple[
diff --git a/gn_auth/auth/authorisation/groups/models.py b/gn_auth/auth/authorisation/groups/models.py
index 5a3ae50..9008bef 100644
--- a/gn_auth/auth/authorisation/groups/models.py
+++ b/gn_auth/auth/authorisation/groups/models.py
@@ -7,9 +7,9 @@ from typing import Any, Sequence, Iterable, Optional, NamedTuple
from flask import g
from pymonad.maybe import Just, Maybe, Nothing
-from gn3.auth import db
-from gn3.auth.dictify import dictify
-from gn3.auth.authentication.users import User, user_by_id
+from gn_auth.auth import db
+from gn_auth.auth.dictify import dictify
+from gn_auth.auth.authentication.users import User, user_by_id
from ..checks import authorised_p
from ..privileges import Privilege
diff --git a/gn_auth/auth/authorisation/groups/views.py b/gn_auth/auth/authorisation/groups/views.py
index 628df36..d1724cc 100644
--- a/gn_auth/auth/authorisation/groups/views.py
+++ b/gn_auth/auth/authorisation/groups/views.py
@@ -7,11 +7,11 @@ from functools import partial
from MySQLdb.cursors import DictCursor
from flask import request, jsonify, Response, Blueprint, current_app
-from gn3.auth import db
-from gn3 import db_utils as gn3db
+from gn_auth.auth import db
+from gn_auth import db_utils as gn3db
-from gn3.auth.dictify import dictify
-from gn3.auth.db_utils import with_db_connection
+from gn_auth.auth.dictify import dictify
+from gn_auth.auth.db_utils import with_db_connection
from .data import link_data_to_group
from .models import (
diff --git a/gn_auth/auth/authorisation/resources/checks.py b/gn_auth/auth/authorisation/resources/checks.py
index fafde76..a341dbd 100644
--- a/gn_auth/auth/authorisation/resources/checks.py
+++ b/gn_auth/auth/authorisation/resources/checks.py
@@ -3,8 +3,8 @@ from uuid import UUID
from functools import reduce
from typing import Sequence
-from gn3.auth import db
-from gn3.auth.authentication.users import User
+from gn_auth.auth import db
+from gn_auth.auth.authentication.users import User
def __organise_privileges_by_resource_id__(rows):
def __organise__(privs, row):
diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py
index b301a93..d96979f 100644
--- a/gn_auth/auth/authorisation/resources/models.py
+++ b/gn_auth/auth/authorisation/resources/models.py
@@ -5,10 +5,10 @@ from uuid import UUID, uuid4
from functools import reduce, partial
from typing import Any, Dict, Sequence, Optional, NamedTuple
-from gn3.auth import db
-from gn3.auth.dictify import dictify
-from gn3.auth.authentication.users import User
-from gn3.auth.db_utils import with_db_connection
+from gn_auth.auth import db
+from gn_auth.auth.dictify import dictify
+from gn_auth.auth.authentication.users import User
+from gn_auth.auth.db_utils import with_db_connection
from .checks import authorised_for
diff --git a/gn_auth/auth/authorisation/resources/views.py b/gn_auth/auth/authorisation/resources/views.py
index 3b2bbeb..9645303 100644
--- a/gn_auth/auth/authorisation/resources/views.py
+++ b/gn_auth/auth/authorisation/resources/views.py
@@ -6,7 +6,7 @@ from functools import reduce
from flask import request, jsonify, Response, Blueprint, current_app as app
-from gn3.auth.db_utils import with_db_connection
+from gn_auth.auth.db_utils import with_db_connection
from .checks import authorised_for
from .models import (
diff --git a/gn_auth/auth/authorisation/roles/models.py b/gn_auth/auth/authorisation/roles/models.py
index 97e11af..742a90e 100644
--- a/gn_auth/auth/authorisation/roles/models.py
+++ b/gn_auth/auth/authorisation/roles/models.py
@@ -5,10 +5,10 @@ from typing import Any, Sequence, Iterable, NamedTuple
from pymonad.either import Left, Right, Either
-from gn3.auth import db
-from gn3.auth.dictify import dictify
-from gn3.auth.authentication.users import User
-from gn3.auth.authorisation.errors import AuthorisationError
+from gn_auth.auth import db
+from gn_auth.auth.dictify import dictify
+from gn_auth.auth.authentication.users import User
+from gn_auth.auth.authorisation.errors import AuthorisationError
from ..checks import authorised_p
from ..privileges import Privilege
diff --git a/gn_auth/auth/authorisation/roles/views.py b/gn_auth/auth/authorisation/roles/views.py
index 3670aab..6510365 100644
--- a/gn_auth/auth/authorisation/roles/views.py
+++ b/gn_auth/auth/authorisation/roles/views.py
@@ -3,8 +3,8 @@ import uuid
from flask import jsonify, Response, Blueprint, current_app
-from gn3.auth import db
-from gn3.auth.dictify import dictify
+from gn_auth.auth import db
+from gn_auth.auth.dictify import dictify
from .models import user_role
diff --git a/gn_auth/auth/authorisation/users/admin/ui.py b/gn_auth/auth/authorisation/users/admin/ui.py
index 242c7a6..4351a68 100644
--- a/gn_auth/auth/authorisation/users/admin/ui.py
+++ b/gn_auth/auth/authorisation/users/admin/ui.py
@@ -2,11 +2,11 @@
from functools import wraps
from flask import flash, url_for, redirect
-from gn3.auth.authentication.users import User
-from gn3.auth.db_utils import with_db_connection
-from gn3.auth.authorisation.roles.models import user_roles
+from gn_auth.auth.authentication.users import User
+from gn_auth.auth.db_utils import with_db_connection
+from gn_auth.auth.authorisation.roles.models import user_roles
-from gn3.session import logged_in, session_user, clear_session_info
+from gn_auth.session import logged_in, session_user, clear_session_info
def is_admin(func):
"""Verify user is a system admin."""
diff --git a/gn_auth/auth/authorisation/users/admin/views.py b/gn_auth/auth/authorisation/users/admin/views.py
index c9f1887..ab04f91 100644
--- a/gn_auth/auth/authorisation/users/admin/views.py
+++ b/gn_auth/auth/authorisation/users/admin/views.py
@@ -17,17 +17,17 @@ from flask import (
render_template)
-from gn3 import session
-from gn3.auth import db
-from gn3.auth.db_utils import with_db_connection
+from gn_auth import session
+from gn_auth.auth import db
+from gn_auth.auth.db_utils import with_db_connection
-from gn3.auth.authentication.oauth2.models.oauth2client import (
+from gn_auth.auth.authentication.oauth2.models.oauth2client import (
save_client,
OAuth2Client,
oauth2_clients,
client as oauth2_client,
delete_client as _delete_client)
-from gn3.auth.authentication.users import (
+from gn_auth.auth.authentication.users import (
User,
user_by_id,
valid_login,
diff --git a/gn_auth/auth/authorisation/users/collections/models.py b/gn_auth/auth/authorisation/users/collections/models.py
index 7577fa8..eb9b188 100644
--- a/gn_auth/auth/authorisation/users/collections/models.py
+++ b/gn_auth/auth/authorisation/users/collections/models.py
@@ -6,7 +6,7 @@ from datetime import datetime
from redis import Redis
from email_validator import validate_email, EmailNotValidError
-from gn3.auth.authorisation.errors import InvalidData, NotFoundError
+from gn_auth.auth.authorisation.errors import InvalidData, NotFoundError
from ..models import User
diff --git a/gn_auth/auth/authorisation/users/collections/views.py b/gn_auth/auth/authorisation/users/collections/views.py
index 1fa25a3..3dcc10f 100644
--- a/gn_auth/auth/authorisation/users/collections/views.py
+++ b/gn_auth/auth/authorisation/users/collections/views.py
@@ -4,13 +4,13 @@ from uuid import UUID
from redis import Redis
from flask import jsonify, request, Response, Blueprint, current_app
-from gn3.auth import db
-from gn3.auth.db_utils import with_db_connection
-from gn3.auth.authorisation.checks import require_json
-from gn3.auth.authorisation.errors import NotFoundError
+from gn_auth.auth import db
+from gn_auth.auth.db_utils import with_db_connection
+from gn_auth.auth.authorisation.checks import require_json
+from gn_auth.auth.authorisation.errors import NotFoundError
-from gn3.auth.authentication.users import User, user_by_id
-from gn3.auth.authentication.oauth2.resource_server import require_oauth
+from gn_auth.auth.authentication.users import User, user_by_id
+from gn_auth.auth.authentication.oauth2.resource_server import require_oauth
from .models import (
add_traits,
diff --git a/gn_auth/auth/authorisation/users/masquerade/models.py b/gn_auth/auth/authorisation/users/masquerade/models.py
index 9f24b6b..c45d761 100644
--- a/gn_auth/auth/authorisation/users/masquerade/models.py
+++ b/gn_auth/auth/authorisation/users/masquerade/models.py
@@ -5,13 +5,13 @@ from datetime import datetime
from flask import current_app as app
-from gn3.auth import db
+from gn_auth.auth import db
-from gn3.auth.authorisation.errors import ForbiddenAccess
-from gn3.auth.authorisation.roles.models import user_roles
+from gn_auth.auth.authorisation.errors import ForbiddenAccess
+from gn_auth.auth.authorisation.roles.models import user_roles
-from gn3.auth.authentication.users import User
-from gn3.auth.authentication.oauth2.models.oauth2token import (
+from gn_auth.auth.authentication.users import User
+from gn_auth.auth.authentication.oauth2.models.oauth2token import (
OAuth2Token, save_token)
__FIVE_HOURS__ = (60 * 60 * 5)
diff --git a/gn_auth/auth/authorisation/users/masquerade/views.py b/gn_auth/auth/authorisation/users/masquerade/views.py
index 43286a1..9e42945 100644
--- a/gn_auth/auth/authorisation/users/masquerade/views.py
+++ b/gn_auth/auth/authorisation/users/masquerade/views.py
@@ -4,12 +4,12 @@ from functools import partial
from flask import request, jsonify, Response, Blueprint
-from gn3.auth.db_utils import with_db_connection
-from gn3.auth.authorisation.errors import InvalidData
-from gn3.auth.authorisation.checks import require_json
+from gn_auth.auth.db_utils import with_db_connection
+from gn_auth.auth.authorisation.errors import InvalidData
+from gn_auth.auth.authorisation.checks import require_json
-from gn3.auth.authentication.users import user_by_id
-from gn3.auth.authentication.oauth2.resource_server import require_oauth
+from gn_auth.auth.authentication.users import user_by_id
+from gn_auth.auth.authentication.oauth2.resource_server import require_oauth
from .models import masquerade_as
diff --git a/gn_auth/auth/authorisation/users/models.py b/gn_auth/auth/authorisation/users/models.py
index 89c1d22..71fa390 100644
--- a/gn_auth/auth/authorisation/users/models.py
+++ b/gn_auth/auth/authorisation/users/models.py
@@ -2,12 +2,12 @@
import uuid
from functools import reduce
-from gn3.auth import db
-from gn3.auth.authorisation.roles.models import Role
-from gn3.auth.authorisation.checks import authorised_p
-from gn3.auth.authorisation.privileges import Privilege
+from gn_auth.auth import db
+from gn_auth.auth.authorisation.roles.models import Role
+from gn_auth.auth.authorisation.checks import authorised_p
+from gn_auth.auth.authorisation.privileges import Privilege
-from gn3.auth.authentication.users import User
+from gn_auth.auth.authentication.users import User
@authorised_p(
("system:user:list",),
diff --git a/gn_auth/auth/authorisation/users/views.py b/gn_auth/auth/authorisation/users/views.py
index 826e222..7783dca 100644
--- a/gn_auth/auth/authorisation/users/views.py
+++ b/gn_auth/auth/authorisation/users/views.py
@@ -7,9 +7,9 @@ import sqlite3
from email_validator import validate_email, EmailNotValidError
from flask import request, jsonify, Response, Blueprint, current_app
-from gn3.auth import db
-from gn3.auth.dictify import dictify
-from gn3.auth.db_utils import with_db_connection
+from gn_auth.auth import db
+from gn_auth.auth.dictify import dictify
+from gn_auth.auth.db_utils import with_db_connection
from .models import list_users
from .masquerade.views import masq