forked from dimagi/commcare-hq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
privileges.py
180 lines (146 loc) · 5.66 KB
/
privileges.py
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
from django.utils.translation import ugettext_lazy as _
LOOKUP_TABLES = 'lookup_tables'
API_ACCESS = 'api_access'
CLOUDCARE = 'cloudcare'
GEOCODER = 'geocoder'
ACTIVE_DATA_MANAGEMENT = 'active_data_management'
CUSTOM_BRANDING = 'custom_branding'
CUSTOM_REPORTS = 'custom_reports'
# Legacy privilege associated with Pro plan
REPORT_BUILDER = 'user_configurable_report_builder'
# A la carte privileges that will be used in custom plans until "Add Ons" are
# added to the accounting system.
REPORT_BUILDER_TRIAL = 'report_builder_trial'
REPORT_BUILDER_5 = 'report_builder_5_reports'
REPORT_BUILDER_15 = 'report_builder_15_reports'
REPORT_BUILDER_30 = 'report_builder_30_reports'
REPORT_BUILDER_ADD_ON_PRIVS = {
REPORT_BUILDER_TRIAL,
REPORT_BUILDER_5,
REPORT_BUILDER_15,
REPORT_BUILDER_30,
}
ROLE_BASED_ACCESS = 'role_based_access'
RESTRICT_ACCESS_BY_LOCATION = 'restrict_access_by_location'
OUTBOUND_SMS = 'outbound_sms'
REMINDERS_FRAMEWORK = 'reminders_framework'
CUSTOM_SMS_GATEWAY = 'custom_sms_gateway'
INBOUND_SMS = 'inbound_sms'
BULK_CASE_MANAGEMENT = 'bulk_case_management'
BULK_USER_MANAGEMENT = 'bulk_user_management'
DEIDENTIFIED_DATA = 'deidentified_data'
HIPAA_COMPLIANCE_ASSURANCE = 'hipaa_compliance_assurance'
ALLOW_EXCESS_USERS = 'allow_excess_users'
COMMCARE_LOGO_UPLOADER = 'commcare_logo_uploader'
LOCATIONS = 'locations'
USER_CASE = 'user_case'
DATA_CLEANUP = 'data_cleanup' # bulk archive cases, edit submissions, auto update cases, etc.
TEMPLATED_INTENTS = 'templated_intents'
CUSTOM_INTENTS = 'custom_intents'
ADVANCED_DOMAIN_SECURITY = 'advanced_domain_security'
BUILD_PROFILES = 'build_profiles'
EXCEL_DASHBOARD = 'excel_dashboard'
DAILY_SAVED_EXPORT = 'daily_saved_export'
ZAPIER_INTEGRATION = 'zapier_integration'
LOGIN_AS = 'login_as'
PRACTICE_MOBILE_WORKERS = 'practice_mobile_workers'
CASE_SHARING_GROUPS = 'case_sharing_groups'
CHILD_CASES = 'child_cases'
ODATA_FEED = 'odata_feeed'
DATA_FORWARDING = 'data_forwarding'
PROJECT_ACCESS = 'project_access'
APP_USER_PROFILES = 'app_user_profiles'
MAX_PRIVILEGES = [
LOOKUP_TABLES,
API_ACCESS,
CLOUDCARE,
ACTIVE_DATA_MANAGEMENT,
CUSTOM_BRANDING,
CUSTOM_REPORTS,
ROLE_BASED_ACCESS,
RESTRICT_ACCESS_BY_LOCATION,
OUTBOUND_SMS,
REMINDERS_FRAMEWORK,
CUSTOM_SMS_GATEWAY,
INBOUND_SMS,
BULK_CASE_MANAGEMENT,
BULK_USER_MANAGEMENT,
DEIDENTIFIED_DATA,
HIPAA_COMPLIANCE_ASSURANCE,
ALLOW_EXCESS_USERS,
COMMCARE_LOGO_UPLOADER,
LOCATIONS,
REPORT_BUILDER,
REPORT_BUILDER_TRIAL,
REPORT_BUILDER_5,
REPORT_BUILDER_15,
REPORT_BUILDER_30,
USER_CASE,
DATA_CLEANUP,
TEMPLATED_INTENTS,
CUSTOM_INTENTS,
BUILD_PROFILES,
ADVANCED_DOMAIN_SECURITY,
EXCEL_DASHBOARD,
DAILY_SAVED_EXPORT,
ZAPIER_INTEGRATION,
LOGIN_AS,
PRACTICE_MOBILE_WORKERS,
CASE_SHARING_GROUPS,
CHILD_CASES,
ODATA_FEED,
DATA_FORWARDING,
PROJECT_ACCESS,
APP_USER_PROFILES,
GEOCODER,
]
# These are special privileges related to their own rates in a SoftwarePlanVersion
MOBILE_WORKER_CREATION = 'mobile_worker_creation'
# Other privileges related specifically to accounting processes
ACCOUNTING_ADMIN = 'accounting_admin'
OPERATIONS_TEAM = 'dimagi_ops'
class Titles(object):
@classmethod
def get_name_from_privilege(cls, privilege):
return {
LOOKUP_TABLES: _("Lookup Tables"),
API_ACCESS: _("API Access"),
CLOUDCARE: _("Web-Based Apps (CloudCare)"),
ACTIVE_DATA_MANAGEMENT: _("Active Data Management"),
CUSTOM_BRANDING: _("Custom Branding"),
ROLE_BASED_ACCESS: _("Advanced Role-Based Access"),
RESTRICT_ACCESS_BY_LOCATION: _("Organization-based data export and user management restrictions"),
OUTBOUND_SMS: _("Outgoing Messaging"),
INBOUND_SMS: _("Incoming Messaging"),
REMINDERS_FRAMEWORK: _("Reminders Framework"),
CUSTOM_SMS_GATEWAY: _("Custom Android Gateway"),
BULK_CASE_MANAGEMENT: _("Bulk Case Management"),
BULK_USER_MANAGEMENT: _("Bulk User Management"),
ALLOW_EXCESS_USERS: _("Add Mobile Workers Above Limit"),
DEIDENTIFIED_DATA: _("De-Identified Data"),
HIPAA_COMPLIANCE_ASSURANCE: _("HIPAA Compliance Assurance"),
COMMCARE_LOGO_UPLOADER: _("Custom CommCare Logo Uploader"),
LOCATIONS: _("Locations"),
REPORT_BUILDER: _('User Configurable Report Builder'),
REPORT_BUILDER_TRIAL: _('Report Builder Trial'),
REPORT_BUILDER_5: _('Report Builder, 5 report limit'),
REPORT_BUILDER_15: _('Report Builder, 15 report limit'),
REPORT_BUILDER_30: _('Report Builder, 30 report limit'),
TEMPLATED_INTENTS: _('Built-in Integration'),
CUSTOM_INTENTS: _('External Integration Framework'),
DATA_CLEANUP: _('Data Management'),
ADVANCED_DOMAIN_SECURITY: _('Domain Level Security Features'),
BUILD_PROFILES: _('Build Profiles'),
EXCEL_DASHBOARD: _('Excel Dashboard'),
DAILY_SAVED_EXPORT: _('Daily saved export'),
ZAPIER_INTEGRATION: _('Zapier Integration'),
LOGIN_AS: _('Login As for App Preview'),
PRACTICE_MOBILE_WORKERS: _('Practice mode for mobile workers'),
CASE_SHARING_GROUPS: _('Case Sharing via Groups'),
CHILD_CASES: _('Child Cases'),
ODATA_FEED: _('Power BI / Tableau Integration'),
DATA_FORWARDING: _("Data Forwarding"),
PROJECT_ACCESS: _("Project Features"),
APP_USER_PROFILES: _("App User Profiles"),
GEOCODER: _("Geocoder"),
}.get(privilege, privilege)