forked from openedx/openedx-authz
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.py
More file actions
71 lines (46 loc) · 1.58 KB
/
data.py
File metadata and controls
71 lines (46 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""Data classes and enums for the Open edX AuthZ REST API."""
from enum import Enum
class BaseEnum(str, Enum):
"""Base enum class."""
@classmethod
def values(cls):
"""List the values of the enum."""
return [e.value for e in cls]
class SortField(BaseEnum):
"""Enum for the fields to sort by."""
USERNAME = "username"
FULL_NAME = "full_name"
EMAIL = "email"
class AssignmentSortField(BaseEnum):
"""Enum for the role assignment fields to sort by."""
ROLE = "role"
ORG = "org"
SCOPE = "scope"
class UserAssignmentSortField(BaseEnum):
"""Enum for the user role assignment fields to sort by."""
ROLE = "role"
ORG = "org"
SCOPE = "scope"
NAME = "full_name"
USERNAME = "username"
EMAIL = "email"
class SortOrder(BaseEnum):
"""Enum for the order to sort by."""
ASC = "asc"
DESC = "desc"
class SearchField(BaseEnum):
"""Enum for the fields allowed for text search filtering."""
USERNAME = "username"
FULL_NAME = "full_name"
EMAIL = "email"
class RoleOperationStatus(BaseEnum):
"""Enum for the status of role assignment and removal operations."""
ROLE_ADDED = "role_added"
ROLE_REMOVED = "role_removed"
class RoleOperationError(BaseEnum):
"""Enum for errors that can occur during role assignment and removal operations."""
USER_NOT_FOUND = "user_not_found"
USER_ALREADY_HAS_ROLE = "user_already_has_role"
USER_DOES_NOT_HAVE_ROLE = "user_does_not_have_role"
ROLE_ASSIGNMENT_ERROR = "role_assignment_error"
ROLE_REMOVAL_ERROR = "role_removal_error"