mirror of
https://github.com/zulip/zulip.git
synced 2026-06-12 21:00:58 +08:00
billing: Improve error message for require_billing_access.
This commit is contained in:
parent
4533f8f962
commit
7dc021a6b2
@ -710,7 +710,7 @@ class RequiresBillingAccessTest(ZulipTestCase):
|
||||
# Normal users do not have access
|
||||
self.login(self.example_email('cordelia'))
|
||||
response = self.client_post(url, request_data)
|
||||
self.assert_json_error_contains(response, "Access denied")
|
||||
self.assert_json_error_contains(response, "Must be a billing administrator or an organization")
|
||||
|
||||
# Billing admins have access
|
||||
self.login(self.example_email('hamlet'))
|
||||
|
||||
@ -139,7 +139,7 @@ def require_billing_access(func: ViewFuncT) -> ViewFuncT:
|
||||
@wraps(func)
|
||||
def wrapper(request: HttpRequest, user_profile: UserProfile, *args: Any, **kwargs: Any) -> HttpResponse:
|
||||
if not user_profile.is_realm_admin and not user_profile.is_billing_admin:
|
||||
raise JsonableError(_("Access denied"))
|
||||
raise JsonableError(_("Must be a billing administrator or an organization administrator"))
|
||||
return func(request, user_profile, *args, **kwargs)
|
||||
return wrapper # type: ignore # https://github.com/python/mypy/issues/1927
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user