diff --git a/corehq/apps/domain/forms.py b/corehq/apps/domain/forms.py index cedbea91bf8e..45f4a79e072b 100644 --- a/corehq/apps/domain/forms.py +++ b/corehq/apps/domain/forms.py @@ -1167,7 +1167,8 @@ class DomainInternalForm(forms.Form, SubAreaMixin): required=False, ) - def __init__(self, domain, can_edit_eula, *args, **kwargs): + def __init__(self, domain, can_edit_eula, *args, user, **kwargs): + self.user = user super(DomainInternalForm, self).__init__(*args, **kwargs) self.domain = domain self.can_edit_eula = can_edit_eula @@ -1266,6 +1267,13 @@ def __init__(self, domain, can_edit_eula, *args, **kwargs): ), ) + if not self.user.is_staff: + self.fields['auto_case_update_limit'].disabled = True + self.fields['auto_case_update_limit'].help_text = ( + 'Case update rule limits are only modifiable by Dimagi admins. ' + 'Please reach out to support@dimagi.com if you wish to update this setting.' + ) + @property def current_values(self): return { diff --git a/corehq/apps/domain/views/internal.py b/corehq/apps/domain/views/internal.py index 3de9ede8262a..fea49af6f3d2 100644 --- a/corehq/apps/domain/views/internal.py +++ b/corehq/apps/domain/views/internal.py @@ -97,7 +97,8 @@ def dispatch(self, request, *args, **kwargs): def internal_settings_form(self): can_edit_eula = toggles.CAN_EDIT_EULA.enabled(self.request.couch_user.username) if self.request.method == 'POST': - return DomainInternalForm(self.request.domain, can_edit_eula, self.request.POST) + return DomainInternalForm(self.request.domain, can_edit_eula, + self.request.POST, user=self.request.user) initial = { 'countries': self.domain_object.deployment.countries, 'is_test': self.domain_object.is_test, @@ -150,7 +151,7 @@ def internal_settings_form(self): initial['active_ucr_expressions'] = AllowedUCRExpressionSettings.get_allowed_ucr_expressions( domain_name=self.domain_object.name ) - return DomainInternalForm(self.request.domain, can_edit_eula, initial=initial) + return DomainInternalForm(self.request.domain, can_edit_eula, initial=initial, user=self.request.user) @property def page_context(self):