about summary refs log tree commit diff
path: root/gn_auth/auth/authorisation/resources
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth/auth/authorisation/resources')
-rw-r--r--gn_auth/auth/authorisation/resources/models.py3
-rw-r--r--gn_auth/auth/authorisation/resources/views.py6
2 files changed, 4 insertions, 5 deletions
diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py
index 16f0359..0de286b 100644
--- a/gn_auth/auth/authorisation/resources/models.py
+++ b/gn_auth/auth/authorisation/resources/models.py
@@ -4,8 +4,6 @@ from uuid import UUID, uuid4
 from functools import reduce, partial
 from typing import Dict, Sequence, Optional
 
-import sqlite3
-
 from gn_auth.auth.db import sqlite3 as db
 from gn_auth.auth.authentication.users import User
 from gn_auth.auth.db.sqlite3 import with_db_connection
@@ -78,6 +76,7 @@ def create_resource(# pylint: disable=[too-many-arguments, too-many-positional-a
 
 
 def delete_resource(conn: db.DbConnection, resource_id: UUID):
+    """Delete a resource."""
     with db.cursor(conn) as cursor:
         cursor.execute("DELETE FROM user_roles WHERE resource_id=?",
                        (str(resource_id),))
diff --git a/gn_auth/auth/authorisation/resources/views.py b/gn_auth/auth/authorisation/resources/views.py
index 920ea76..c4774dc 100644
--- a/gn_auth/auth/authorisation/resources/views.py
+++ b/gn_auth/auth/authorisation/resources/views.py
@@ -75,8 +75,7 @@ def create_resource() -> Response:
         resource_name = form.get("resource_name")
         resource_category_id = UUID(form.get("resource_category"))
         db_uri = app.config["AUTH_DB"]
-        with (db.connection(db_uri) as conn,
-              db.cursor(conn) as cursor):
+        with db.connection(db_uri) as conn:
             try:
                 group = user_group(conn, the_token.user).maybe(
                     False, lambda grp: grp)# type: ignore[misc, arg-type]
@@ -686,7 +685,8 @@ def delete_resource() -> Response:
         form = request_json()
         try:
             resource_id = UUID(form.get("resource_id"))
-            # TODO Update user-levels promotion/demotion to grant/revoke (system:resource:*) to/from admin users
+            # TODO Update user-levels promotion/demotion to grant/revoke
+            #      (system:resource:*) to/from admin users
             if not authorised_for_spec(
                     conn,
                     the_token.user.user_id,