aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation/resources
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-09-27 10:09:53 +0300
committerFrederick Muriuki Muriithi2023-09-27 10:37:07 +0300
commita8ebba8266618ec53fe485ee84d09d0cdff898a1 (patch)
treefd019b3672e62573813123c43e9fa9843153bb10 /gn_auth/auth/authorisation/resources
parent938efc6d8d2713d5f8dd399e9c878b95832ac882 (diff)
downloadgn-auth-a8ebba8266618ec53fe485ee84d09d0cdff898a1.tar.gz
typing: fix and ignore typing issues.
Diffstat (limited to 'gn_auth/auth/authorisation/resources')
-rw-r--r--gn_auth/auth/authorisation/resources/checks.py4
-rw-r--r--gn_auth/auth/authorisation/resources/groups/views.py8
-rw-r--r--gn_auth/auth/authorisation/resources/models.py2
3 files changed, 10 insertions, 4 deletions
diff --git a/gn_auth/auth/authorisation/resources/checks.py b/gn_auth/auth/authorisation/resources/checks.py
index 717e5e4..d8e3a9f 100644
--- a/gn_auth/auth/authorisation/resources/checks.py
+++ b/gn_auth/auth/authorisation/resources/checks.py
@@ -16,7 +16,9 @@ def __organise_privileges_by_resource_id__(rows):
}
return reduce(__organise__, rows, {})
-def authorised_for(conn: db.DbConnection, user: User, privileges: tuple[str],
+def authorised_for(conn: db.DbConnection,
+ user: User,
+ privileges: tuple[str, ...],
resource_ids: Sequence[UUID]) -> dict[UUID, bool]:
"""
Check whether `user` is authorised to access `resources` according to given
diff --git a/gn_auth/auth/authorisation/resources/groups/views.py b/gn_auth/auth/authorisation/resources/groups/views.py
index ba34040..96cfb67 100644
--- a/gn_auth/auth/authorisation/resources/groups/views.py
+++ b/gn_auth/auth/authorisation/resources/groups/views.py
@@ -324,8 +324,12 @@ def group_privileges():
group_level_roles = tuple(
Privilege(row["privilege_id"], row["privilege_description"])
for row in cursor.fetchall())
- return tuple(privilege for arole in this_user_roles
- for privilege in arole.privileges) + group_level_roles
+
+ ## the `user_roles(...)` function changed thus this entire function
+ ## needs to change or be obsoleted -- also remove the ignore below
+ return tuple(
+ privilege for arole in this_user_roles
+ for privilege in arole.privileges) + group_level_roles #type: ignore[attr-defined]
return jsonify(tuple(
dictify(priv) for priv in with_db_connection(__list_privileges__)))
diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py
index bca2ff9..f4be978 100644
--- a/gn_auth/auth/authorisation/resources/models.py
+++ b/gn_auth/auth/authorisation/resources/models.py
@@ -188,7 +188,7 @@ def resource_data(conn, resource, offset: int = 0, limit: Optional[int] = None)
with db.cursor(conn) as cursor:
return tuple(
dict(data_row) for data_row in
- resource_data_function[
+ resource_data_function[# type: ignore[operator]
resource.resource_category.resource_category_key](
cursor, resource.resource_id, offset, limit))