aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation/resources
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-17 14:25:47 -0500
committerFrederick Muriuki Muriithi2024-06-17 14:25:47 -0500
commit4b0eed1a90a200a4283778b10d116f4f76ad9455 (patch)
tree87025b94c31a50fed3ff7ae83aa26dcdd9407257 /gn_auth/auth/authorisation/resources
parent1776582ab9d44758793cab70978b353c00be51bc (diff)
downloadgn-auth-4b0eed1a90a200a4283778b10d116f4f76ad9455.tar.gz
Fix linting errors.
Diffstat (limited to 'gn_auth/auth/authorisation/resources')
-rw-r--r--gn_auth/auth/authorisation/resources/groups/views.py1
-rw-r--r--gn_auth/auth/authorisation/resources/views.py16
2 files changed, 9 insertions, 8 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/views.py b/gn_auth/auth/authorisation/resources/groups/views.py
index beb2b42..f22e15d 100644
--- a/gn_auth/auth/authorisation/resources/groups/views.py
+++ b/gn_auth/auth/authorisation/resources/groups/views.py
@@ -15,7 +15,6 @@ from gn_auth.auth.db import sqlite3 as db
from gn_auth.auth.db import mariadb as gn3db
from gn_auth.auth.db.sqlite3 import with_db_connection
-from gn_auth.auth.authorisation.roles.models import Role
from gn_auth.auth.authorisation.roles.models import user_roles
from gn_auth.auth.authorisation.checks import authorised_p
diff --git a/gn_auth/auth/authorisation/resources/views.py b/gn_auth/auth/authorisation/resources/views.py
index 736b315..0849466 100644
--- a/gn_auth/auth/authorisation/resources/views.py
+++ b/gn_auth/auth/authorisation/resources/views.py
@@ -19,13 +19,16 @@ from gn_auth.auth.db.sqlite3 import with_db_connection
from gn_auth.auth.authorisation.roles import Role
from gn_auth.auth.authorisation.roles.models import create_role
-from gn_auth.auth.authorisation.privileges import Privilege
-from gn_auth.auth.authorisation.privileges.models import privileges_by_ids
-from gn_auth.auth.errors import InvalidData, InconsistencyError, AuthorisationError
+from gn_auth.auth.errors import (
+ InvalidData,
+ InconsistencyError,
+ AuthorisationError)
+from gn_auth.auth.authorisation.privileges import (
+ privilege_by_id,
+ privileges_by_ids)
from gn_auth.auth.authorisation.roles.models import (
role_by_id,
db_rows_to_roles,
- check_user_editable,
delete_privilege_from_resource_role)
from gn_auth.auth.authentication.oauth2.resource_server import require_oauth
@@ -510,7 +513,7 @@ def resource_role(resource_id: UUID, role_id: UUID):
_roles = db_rows_to_roles(results)
if len(_roles) > 1:
- msg = f"There is data corruption in the database."
+ msg = "There is data corruption in the database."
return jsonify({
"error": "RoleNotFound",
"error_description": msg,
@@ -530,7 +533,6 @@ def unassign_resource_role_privilege(resource_id: UUID, role_id: UUID):
db.connection(app.config["AUTH_DB"]) as conn,
db.cursor(conn) as cursor):
_role = role_by_id(conn, role_id)
- # check_user_editable(_role) # Check whether role is user editable
_authorised = authorised_for(
conn,
@@ -549,7 +551,7 @@ def unassign_resource_role_privilege(resource_id: UUID, role_id: UUID):
delete_privilege_from_resource_role(cursor,
_role,
- privilege_by_id(privilege_id))
+ privilege_by_id(conn, privilege_id))
return jsonify({
"status": "Success",