aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2021-10-15 08:50:26 +0300
committerBonfaceKilz2021-10-25 14:00:14 +0300
commit3a1db0b113a6ab32926cf6070e7cc89459f83041 (patch)
treefcd632735dcdb07aa34997e6bdbd7c0439b7080b /wqflask
parent6195ad475cddce2007b125b856829cbb41defd30 (diff)
downloadgenenetwork2-3a1db0b113a6ab32926cf6070e7cc89459f83041.tar.gz
Add immutable data structures for admin and data access roles
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/resource_manager.py12
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: