File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed
compliance-api/src/compliance_api Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 1919from flask_jwt_oidc import JwtManager
2020
2121from compliance_api .exceptions import PermissionDeniedError
22+ from compliance_api .utils .constant import GROUP_MAP
2223
2324
2425jwt = (
@@ -82,7 +83,7 @@ def has_permission(cls, permissions):
8283 @staticmethod
8384 def map_permission_to_groups (permissions ):
8485 """Map the permissions to user groups in keycloak."""
85- return [role . value for role in permissions ]
86+ return [GROUP_MAP [ role ] for role in permissions ]
8687
8788
8889auth = Auth ()
Original file line number Diff line number Diff line change 11"""Constants."""
2+ from .enum import PermissionEnum
3+
24
35AUTH_APP = "COMPLIANCE"
46INPUT_DATE_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
79DELETE_DIC_PARAMS = {"is_active" : False , "is_deleted" : True }
810OFFICE_NAME = "Environmental Assessment Office"
911OFFICE_BRANCH = "Compliance and Enforcement Branch"
12+ GROUP_MAP = {
13+ PermissionEnum .SUPERUSER : "super_user" ,
14+ PermissionEnum .VIEWER : "viewer" ,
15+ PermissionEnum .USER : "user" ,
16+ PermissionEnum .ADMIN : "admin" ,
17+ }
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class ContextEnum(Enum):
3737class PermissionEnum (Enum ):
3838 """Enum for Staff User Permissions."""
3939
40- VIEWER = "viewer "
41- USER = "user "
42- SUPERUSER = "super_user "
43- ADMIN = "admin "
40+ VIEWER = "Viewer "
41+ USER = "User "
42+ SUPERUSER = "Superuser "
43+ ADMIN = "Admin "
You can’t perform that action at this time.
0 commit comments