-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathconst.py
More file actions
196 lines (168 loc) · 8.2 KB
/
const.py
File metadata and controls
196 lines (168 loc) · 8.2 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
from flask_babel import lazy_gettext
"""
All constants and messages definitions go here
Log messages obey the following rule:
LOGMSG_<SEV>_<MODULE>_<NAME>
<SEV> :- INF | DEB | WAR | ERR
<MODULE> :- SEC
Flash messages obey the following rule:
FLAMSG_<SEV>_<MODULE>_<NAME>
<SEV> :- INF | DEB | WAR | ERR
<MODULE> :- SEC
"""
LOGMSG_ERR_SEC_ACCESS_DENIED = "Access is Denied for: %s on: %s"
""" Access denied log message, format with user and view/resource """
LOGMSG_WAR_SEC_LOGIN_FAILED = "Login Failed for user: %s"
LOGMSG_ERR_SEC_CREATE_DB = "DB Creation and initialization failed: %s"
""" security models creation fails, format with error message """
LOGMSG_ERR_SEC_ADD_ROLE = "Add Role: %s"
""" Error adding role, format with err message """
LOGMSG_ERR_SEC_ADD_GROUP = "Add Group: %s"
""" Error adding group, format with err message """
LOGMSG_ERR_SEC_ADD_PERMISSION = "Add Permission: %s"
""" Error adding permission, format with err message """
LOGMSG_ERR_SEC_ADD_VIEWMENU = "Add View Menu Error: %s"
""" Error adding view menu, format with err message """
LOGMSG_ERR_SEC_DEL_PERMISSION = "Del Permission Error: %s"
""" Error deleting permission, format with err message """
LOGMSG_ERR_SEC_ADD_PERMVIEW = "Creation of Permission View Error: %s"
""" Error adding permission view, format with err message """
LOGMSG_ERR_SEC_DEL_PERMVIEW = "Remove Permission from View Error: %s"
""" Error deleting permission view, format with err message """
LOGMSG_WAR_SEC_DEL_PERMVIEW = (
"Refused to delete permission view, assoc with role exists %s.%s %s"
)
LOGMSG_WAR_SEC_DEL_PERMISSION = "Refused to delete, permission %s does not exist"
LOGMSG_WAR_SEC_DEL_VIEWMENU = "Refused to delete, view menu %s does not exist"
LOGMSG_WAR_SEC_DEL_PERM_PVM = "Refused to delete permission %s, PVM exists %s"
LOGMSG_WAR_SEC_DEL_VIEWMENU_PVM = "Refused to delete view menu %s, PVM exists %s"
LOGMSG_ERR_SEC_ADD_PERMROLE = "Add Permission to Role Error: %s"
""" Error adding permission to role, format with err message """
LOGMSG_ERR_SEC_DEL_PERMROLE = "Remove Permission to Role Error: %s"
""" Error deleting permission to role, format with err message """
LOGMSG_ERR_SEC_ADD_REGISTER_USER = "Add Register User Error: %s"
""" Error adding registered user, format with err message """
LOGMSG_ERR_SEC_DEL_REGISTER_USER = "Remove Register User Error: %s"
""" Error deleting registered user, format with err message """
LOGMSG_ERR_SEC_NO_REGISTER_HASH = "Attempt to activate user with false hash: %s"
""" Attempt to activate user with not registered hash, format with hash """
LOGMSG_ERR_SEC_AUTH_LDAP = "LDAP Error %s"
""" Generic LDAP error, format with err message """
LOGMSG_ERR_SEC_AUTH_LDAP_TLS = (
"LDAP Could not activate TLS on established connection with %s"
)
""" LDAP Could not activate TLS on established connection with server """
LOGMSG_ERR_SEC_ADD_USER = "Error adding new user to database. %s"
""" Error adding user, format with err message """
LOGMSG_ERR_SEC_UPD_USER = "Error updating user to database. %s "
""" Error updating user, format with err message """
LOGMSG_WAR_SEC_NO_USER = "No user yet created, use flask fab command to do it."
""" Warning when app starts if no user exists on db """
LOGMSG_WAR_SEC_NOLDAP_OBJ = "No LDAP object found for: %s"
LOGMSG_INF_SEC_ADD_PERMVIEW = "Created Permission View: %s"
""" Info when adding permission view, format with permission view class string """
LOGMSG_INF_SEC_DEL_PERMVIEW = "Removed Permission View: %s on %s"
""" Info when deleting permission view, format with permission name and view name """
LOGMSG_INF_SEC_ADD_PERMROLE = "Added Permission %s to role %s"
""" Info when adding permission to role,
format with permission view class string and role name """
LOGMSG_INF_SEC_DEL_PERMROLE = "Removed Permission %s to role %s"
""" Info when deleting permission to role,
format with permission view class string and role name """
LOGMSG_INF_SEC_ADD_ROLE = "Inserted Role: %s"
""" Info when added role, format with role name """
LOGMSG_INF_SEC_NO_DB = "Security DB not found Creating all Models from Base"
LOGMSG_INF_SEC_ADD_DB = "Security DB Created"
LOGMSG_INF_SEC_ADD_USER = "Added user %s"
""" User added, format with username """
LOGMSG_INF_SEC_UPD_USER = "Updated user %s"
""" User updated, format with username """
LOGMSG_INF_SEC_UPD_ROLE = "Updated role %s"
""" Role updated, format with role name """
LOGMSG_ERR_SEC_UPD_ROLE = "An error occurred updating role %s"
""" Role updated Error, format with role name """
LOGMSG_INF_FAB_ADDON_ADDED = "Registered AddOn: %s"
""" Addon imported and registered """
LOGMSG_ERR_FAB_ADDON_IMPORT = "An error occurred when importing declared addon %s: %s"
""" Error on addon import, format with addon class path and error message """
LOGMSG_ERR_FAB_ADDON_PROCESS = "An error occurred when processing declared addon %s: %s"
""" Error on addon processing (pre, register, post),
format with addon class path and error message """
LOGMSG_ERR_FAB_ADD_PERMISSION_MENU = "Add Permission on Menu Error: %s"
""" Error when adding a permission to a menu, format with err """
LOGMSG_ERR_FAB_ADD_PERMISSION_VIEW = "Add Permission on View Error: %s"
""" Error when adding a permission to a menu, format with err """
LOGMSG_WAR_DBI_AVG_ZERODIV = "Zero division on aggregate_avg"
LOGMSG_WAR_FAB_VIEW_EXISTS = "View already exists %s ignoring"
""" Attempt to add an already added view, format with view name """
LOGMSG_WAR_DBI_ADD_INTEGRITY = "Add record integrity error: %s"
""" Dabase integrity error, format with err message """
LOGMSG_WAR_DBI_EDIT_INTEGRITY = "Edit record integrity error: %s"
""" Dabase integrity error, format with err message """
LOGMSG_WAR_DBI_DEL_INTEGRITY = "Delete record integrity error: %s"
""" Dabase integrity error, format with err message """
LOGMSG_INF_FAB_ADD_VIEW = "Registering class %s on menu %s"
""" Inform that view class was added, format with class name, name"""
FLAMSG_ERR_SEC_ACCESS_DENIED = lazy_gettext("Access is Denied")
""" Access denied flash message """
PERMISSION_PREFIX = "can_"
""" Prefix to be concatenated to permission names, and inserted in the backend """
AUTH_DB = 1
AUTH_LDAP = 2
AUTH_REMOTE_USER = 3
AUTH_OAUTH = 4
AUTH_SAML = 5
""" Constants for supported authentication types """
# -----------------------------------
# REST API Constants
# -----------------------------------
API_SECURITY_VERSION = "v1"
API_SECURITY_PROVIDER_DB = "db"
API_SECURITY_PROVIDER_LDAP = "ldap"
API_SECURITY_USERNAME_KEY = "username"
API_SECURITY_PASSWORD_KEY = "password"
API_SECURITY_PROVIDER_KEY = "provider"
API_SECURITY_REFRESH_KEY = "refresh"
API_SECURITY_ACCESS_TOKEN_KEY = "access_token"
API_SECURITY_REFRESH_TOKEN_KEY = "refresh_token"
# Response keys
API_ORDER_COLUMNS_RES_KEY = "order_columns"
API_LABEL_COLUMNS_RES_KEY = "label_columns"
API_LIST_COLUMNS_RES_KEY = "list_columns"
API_SHOW_COLUMNS_RES_KEY = "show_columns"
API_ADD_COLUMNS_RES_KEY = "add_columns"
API_EDIT_COLUMNS_RES_KEY = "edit_columns"
API_DESCRIPTION_COLUMNS_RES_KEY = "description_columns"
API_RESULT_RES_KEY = "result"
API_FILTERS_RES_KEY = "filters"
API_PERMISSIONS_RES_KEY = "permissions"
API_LIST_TITLE_RES_KEY = "list_title"
API_ADD_TITLE_RES_KEY = "add_title"
API_EDIT_TITLE_RES_KEY = "edit_title"
API_SHOW_TITLE_RES_KEY = "show_title"
# Request Rison keys
API_URI_RIS_KEY = "q"
API_ORDER_COLUMNS_RIS_KEY = "order_columns"
API_LABEL_COLUMNS_RIS_KEY = "label_columns"
API_LIST_COLUMNS_RIS_KEY = "list_columns"
API_SHOW_COLUMNS_RIS_KEY = "show_columns"
API_ADD_COLUMNS_RIS_KEY = "add_columns"
API_EDIT_COLUMNS_RIS_KEY = "edit_columns"
API_DESCRIPTION_COLUMNS_RIS_KEY = "description_columns"
API_FILTERS_RIS_KEY = "filters"
API_PERMISSIONS_RIS_KEY = "permissions"
API_SELECT_COLUMNS_RIS_KEY = "columns"
API_SELECT_SEL_COLUMNS_RIS_KEY = "select_columns"
API_SELECT_KEYS_RIS_KEY = "keys"
API_ORDER_COLUMN_RIS_KEY = "order_column"
API_ORDER_DIRECTION_RIS_KEY = "order_direction"
API_PAGE_INDEX_RIS_KEY = "page"
API_PAGE_SIZE_RIS_KEY = "page_size"
API_LIST_TITLE_RIS_KEY = "list_title"
API_ADD_TITLE_RIS_KEY = "add_title"
API_EDIT_TITLE_RIS_KEY = "edit_title"
API_SHOW_TITLE_RIS_KEY = "show_title"
# -----------------------------------
# OAuth Provider Constants
# -----------------------------------
MICROSOFT_KEY_SET_URL = "https://login.microsoftonline.com/common/discovery/keys"