diff options
author | Munyoki Kilyungi | 2024-03-12 00:29:30 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2024-03-13 10:30:09 +0300 |
commit | 8ccf7409f6c89c3c5079a73c73dc2f6bfae086a7 (patch) | |
tree | 71a46ef3fe602bda25ec99fc0ecda93f6ed6a81f /gn_auth/auth/authorisation/resources/models.py | |
parent | 6b529aa323b065dee0e387f06e6c0d2264ac542e (diff) | |
download | gn-auth-8ccf7409f6c89c3c5079a73c73dc2f6bfae086a7.tar.gz |
Define Privilege/Role using frozen dataclass.
* gn_auth/auth/authorisation/privileges.py: Import dataclass. Remove
NamedTuple import.
(Privilege): Use frozen dataclass.
(Privelege.dictify): Delete.
* gn_auth/auth/authorisation/resources/groups/views.py: Import
dataclasses.asdict.
(group_privileges): Replace dictify with asdict.
(add_priv_to_role): Ditto.
(delete_priv_from_role): Ditto.
* gn_auth/auth/authorisation/resources/models.py:
(assign_resource_user): Replace dictify with asdict.
(unassign_resource_user): Ditto.
* gn_auth/auth/authorisation/resources/system/views.py: Import
dataclasses.asdict. Remove dictify import.
(system_roles): Replace dictify with asdict.
* gn_auth/auth/authorisation/resources/views.py:
(resource_users): Replace dictify with asdict.
(resources_authorisation): Ditto.
* gn_auth/auth/authorisation/roles/models.py: Remove dictify and
NameTuple import.
(Role): Use frozen dataclass.
(Role.dictify): Replace dictify(priv) with asdict(priv).
* gn_auth/auth/authorisation/roles/views.py: Import
dataclasses.asdict. Remove dictify import.
(view_role): Replace dictify with asdict.
* gn_auth/auth/authorisation/users/views.py:
(user_roles): Replace dictify with asdict.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn_auth/auth/authorisation/resources/models.py')
-rw-r--r-- | gn_auth/auth/authorisation/resources/models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gn_auth/auth/authorisation/resources/models.py b/gn_auth/auth/authorisation/resources/models.py index 7ebf5f7..97e6adf 100644 --- a/gn_auth/auth/authorisation/resources/models.py +++ b/gn_auth/auth/authorisation/resources/models.py @@ -343,7 +343,7 @@ def assign_resource_user( return { "resource": dictify(resource), "user": asdict(user), - "role": dictify(role), + "role": asdict(role), "description": ( f"The user '{user.name}'({user.email}) was assigned the " f"'{role.role.role_name}' role on resource with ID " @@ -367,7 +367,7 @@ def unassign_resource_user( return { "resource": dictify(resource), "user": asdict(user), - "role": dictify(role), + "role": asdict(role), "description": ( f"The user '{user.name}'({user.email}) had the " f"'{role.role.role_name}' role on resource with ID " |