diff options
author | BonfaceKilz | 2021-10-15 08:50:26 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-10-25 14:00:14 +0300 |
commit | 3a1db0b113a6ab32926cf6070e7cc89459f83041 (patch) | |
tree | fcd632735dcdb07aa34997e6bdbd7c0439b7080b | |
parent | 6195ad475cddce2007b125b856829cbb41defd30 (diff) | |
download | genenetwork2-3a1db0b113a6ab32926cf6070e7cc89459f83041.tar.gz |
Add immutable data structures for admin and data access roles
-rw-r--r-- | wqflask/wqflask/resource_manager.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/wqflask/wqflask/resource_manager.py b/wqflask/wqflask/resource_manager.py index 330600ed..7f4718f0 100644 --- a/wqflask/wqflask/resource_manager.py +++ b/wqflask/wqflask/resource_manager.py @@ -2,7 +2,7 @@ import redis import json import functools -from enum import Enum +from enum import Enum, unique @@ -23,8 +23,18 @@ class OrderedEnum(Enum): return NotImplemented +@unique +class DataRole(OrderedEnum): + NO_ACCESS = "no-access" + VIEW = "view" + EDIT = "edit" +@unique +class AdminRole(OrderedEnum): + NOT_ADMIN = "not-admin" + EDIT_ACCESS = "edit-access" + EDIT_ADMINS = "edit-admins" def get_user_membership(conn: redis.Redis, user_id: str, group_id: str) -> Dict: |