diff options
author | Frederick Muriuki Muriithi | 2024-06-10 17:12:59 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-06-11 11:24:59 -0500 |
commit | e1f2966c0764980008a8caad6d2ba41a5ad0d853 (patch) | |
tree | 09df83b31ca5be14262672d852c7bc4b9350d30a /gn_auth/auth/authorisation/roles | |
parent | 29e077e1f2f49e1cc3162731a9b5359fa21a6ba1 (diff) | |
download | gn-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.py | 11 |
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)) |