aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation/users
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth/auth/authorisation/users')
-rw-r--r--gn_auth/auth/authorisation/users/__init__.py1
-rw-r--r--gn_auth/auth/authorisation/users/admin/ui.py9
-rw-r--r--gn_auth/auth/authorisation/users/admin/views.py8
-rw-r--r--gn_auth/auth/authorisation/users/collections/models.py2
-rw-r--r--gn_auth/auth/authorisation/users/collections/views.py13
-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
9 files changed, 36 insertions, 33 deletions
diff --git a/gn_auth/auth/authorisation/users/__init__.py b/gn_auth/auth/authorisation/users/__init__.py
index e69de29..dbc6482 100644
--- a/gn_auth/auth/authorisation/users/__init__.py
+++ b/gn_auth/auth/authorisation/users/__init__.py
@@ -0,0 +1 @@
+"""Users module."""
diff --git a/gn_auth/auth/authorisation/users/admin/ui.py b/gn_auth/auth/authorisation/users/admin/ui.py
index 9087412..68e1ba5 100644
--- a/gn_auth/auth/authorisation/users/admin/ui.py
+++ b/gn_auth/auth/authorisation/users/admin/ui.py
@@ -2,12 +2,13 @@
from functools import wraps
from flask import flash, url_for, redirect
-from gn_auth.auth.authentication.users import User
-from gn_auth.auth.db.sqlite3 import with_db_connection
-from gn_auth.auth.authorisation.roles.models import user_roles
-
from gn_auth.session import logged_in, session_user, clear_session_info
+from ....authentication.users import User
+from ....db.sqlite3 import with_db_connection
+
+from ...roles.models import user_roles
+
def is_admin(func):
"""Verify user is a system admin."""
@wraps(func)
diff --git a/gn_auth/auth/authorisation/users/admin/views.py b/gn_auth/auth/authorisation/users/admin/views.py
index 4a37bc5..6ace0e5 100644
--- a/gn_auth/auth/authorisation/users/admin/views.py
+++ b/gn_auth/auth/authorisation/users/admin/views.py
@@ -18,16 +18,16 @@ from flask import (
from gn_auth import session
-from gn_auth.auth.db import sqlite3 as db
-from gn_auth.auth.db.sqlite3 import with_db_connection
+from ....db import sqlite3 as db
+from ....db.sqlite3 import with_db_connection
-from gn_auth.auth.authentication.oauth2.models.oauth2client import (
+from ....authentication.oauth2.models.oauth2client import (
save_client,
OAuth2Client,
oauth2_clients,
client as oauth2_client,
delete_client as _delete_client)
-from gn_auth.auth.authentication.users import (
+from ....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 eb9b188..9157100 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 gn_auth.auth.authorisation.errors import InvalidData, NotFoundError
+from ...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 9900205..a1cc30d 100644
--- a/gn_auth/auth/authorisation/users/collections/views.py
+++ b/gn_auth/auth/authorisation/users/collections/views.py
@@ -4,13 +4,14 @@ from uuid import UUID
from redis import Redis
from flask import jsonify, request, Response, Blueprint, current_app
-from gn_auth.auth.db import sqlite3 as db
-from gn_auth.auth.db.sqlite3 import with_db_connection
-from gn_auth.auth.authorisation.checks import require_json
-from gn_auth.auth.authorisation.errors import NotFoundError
+from ....db import sqlite3 as db
+from ....db.sqlite3 import with_db_connection
-from gn_auth.auth.authentication.users import User, user_by_id
-from gn_auth.auth.authentication.oauth2.resource_server import require_oauth
+from ....authentication.users import User, user_by_id
+from ....authentication.oauth2.resource_server import require_oauth
+
+from ...checks import require_json
+from ...errors import NotFoundError
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 9779764..86b9e53 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 gn_auth.auth.db import sqlite3 as db
-from gn_auth.auth.authorisation.errors import ForbiddenAccess
-from gn_auth.auth.authorisation.roles.models import user_roles
+from ...errors import ForbiddenAccess
+from ...roles.models import user_roles
-from gn_auth.auth.authentication.users import User
-from gn_auth.auth.authentication.oauth2.models.oauth2token import (
+from ....db import sqlite3 as db
+from ....authentication.users import User
+from ....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 7bd8ddb..259cdfe 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 gn_auth.auth.db.sqlite3 import with_db_connection
-from gn_auth.auth.authorisation.errors import InvalidData
-from gn_auth.auth.authorisation.checks import require_json
+from ...errors import InvalidData
+from ...checks import require_json
-from gn_auth.auth.authentication.users import user_by_id
-from gn_auth.auth.authentication.oauth2.resource_server import require_oauth
+from ....db.sqlite3 import with_db_connection
+from ....authentication.users import user_by_id
+from ....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 61489cf..9fb9d9e 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 gn_auth.auth.db import sqlite3 as 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 ..roles.models import Role
+from ..checks import authorised_p
+from ..privileges import Privilege
-from gn_auth.auth.authentication.users import User
+from ...db import sqlite3 as db
+from ...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 0646e3a..6de30da 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 gn_auth.auth.db import sqlite3 as db
-from gn_auth.auth.dictify import dictify
-from gn_auth.auth.db.sqlite3 import with_db_connection
+from ...db import sqlite3 as db
+from ...dictify import dictify
+from ...db.sqlite3 import with_db_connection
from .models import list_users
from .masquerade.views import masq