aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/auth/authorisation/roles
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-06-10 17:12:59 -0500
committerFrederick Muriuki Muriithi2024-06-11 11:24:59 -0500
commite1f2966c0764980008a8caad6d2ba41a5ad0d853 (patch)
tree09df83b31ca5be14262672d852c7bc4b9350d30a /gn_auth/auth/authorisation/roles
parent29e077e1f2f49e1cc3162731a9b5359fa21a6ba1 (diff)
downloadgn-auth-e1f2966c0764980008a8caad6d2ba41a5ad0d853.tar.gz
Unassign privilege from resource role.
Diffstat (limited to 'gn_auth/auth/authorisation/roles')
-rw-r--r--gn_auth/auth/authorisation/roles/models.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gn_auth/auth/authorisation/roles/models.py b/gn_auth/auth/authorisation/roles/models.py
index b559bff..e740bfd 100644
--- a/gn_auth/auth/authorisation/roles/models.py
+++ b/gn_auth/auth/authorisation/roles/models.py
@@ -239,3 +239,14 @@ def role_by_id(conn: db.DbConnection, role_id: UUID) -> Optional[Role]:
raise Exception("Data corruption: Expected a single role.")
return _roles[0]
+
+
+def delete_privilege_from_resource_role(
+ cursor: db.DbCursor,
+ role: Role,
+ privilege_id: str
+):
+ """Delete a privilege from a resource role."""
+ cursor.execute(
+ "DELETE FROM role_privileges WHERE role_id=? AND privilege_id=?",
+ (str(role.role_id), privilege.privilege_id))