Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

remote-billing: Update error for user without has_billing_access.

Lauryn Menard35f610296942
diff --git a/corporate/tests/test_remote_billing.py b/corporate/tests/test_remote_billing.py
index b0399e6ef6a..c5a62dda742 100644
--- a/corporate/tests/test_remote_billing.py
+++ b/corporate/tests/test_remote_billing.py
@@ -187,7 +187,9 @@ class SelfHostedBillingEndpointBasicTest(RemoteRealmBillingTestCase):
"/self-hosted-billing/not-configured/",
]:
result = self.client_get(url)
- self.assert_json_error(result, "Must be an organization owner")
+ self.assert_json_error(
+ result, "You do not have permission to manage plans and billing."
+ )
# Login as an organization owner to gain access.
self.login("desdemona")
diff --git a/zerver/views/push_notifications.py b/zerver/views/push_notifications.py
index 8617249fd7d..dec9168812c 100644
--- a/zerver/views/push_notifications.py
+++ b/zerver/views/push_notifications.py
@@ -21,7 +21,6 @@ from zerver.lib.exceptions import (
ErrorCode,
JsonableError,
MissingRemoteRealmError,
- OrganizationOwnerRequiredError,
PushServiceNotConfiguredError,
RemoteRealmServerMismatchError,
ResourceNotFoundError,
@@ -147,6 +146,11 @@ def send_e2ee_test_push_notification_api(
return json_success(request)
+class CannotManageRemoteBillingError(JsonableError):
+ def __init__(self) -> None:
+ super().__init__(_("You do not have permission to manage plans and billing."))
+
+
def self_hosting_auth_view_common(
request: HttpRequest, user_profile: UserProfile, next_page: str | None = None
) -> str:
@@ -155,7 +159,7 @@ def self_hosting_auth_view_common(
# but this endpoint shouldn't be accessible via the UI to an unauthorized
# user_profile - and they need to directly enter the URL in their browser. So a json
# error may be sufficient.
- raise OrganizationOwnerRequiredError
+ raise CannotManageRemoteBillingError
if not uses_notification_bouncer():
if settings.CORPORATE_ENABLED:
@@ -257,7 +261,7 @@ def self_hosting_auth_not_configured(request: HttpRequest) -> HttpResponse:
assert user.is_authenticated
assert isinstance(user, UserProfile)
if not user.has_billing_access:
- raise OrganizationOwnerRequiredError
+ raise CannotManageRemoteBillingError
if settings.CORPORATE_ENABLED or uses_notification_bouncer():
# This error page should only be available if the config error