diff --git a/mathesar/rpc/databases/configured.py b/mathesar/rpc/databases/configured.py index 11b9e6ba31..12166e62bb 100644 --- a/mathesar/rpc/databases/configured.py +++ b/mathesar/rpc/databases/configured.py @@ -1,7 +1,7 @@ from typing import TypedDict from modernrpc.core import rpc_method, REQUEST_KEY -from modernrpc.auth.basic import http_basic_auth_login_required +from modernrpc.auth.basic import http_basic_auth_login_required, http_basic_auth_superuser_required from mathesar.models.base import Database from mathesar.rpc.exceptions.handlers import handle_rpc_exceptions @@ -69,7 +69,7 @@ def list_(*, server_id: int = None, **kwargs) -> list[ConfiguredDatabaseInfo]: @rpc_method(name="databases.configured.disconnect") -@http_basic_auth_login_required +@http_basic_auth_superuser_required @handle_rpc_exceptions def disconnect(*, database_id: int, **kwargs) -> None: """ diff --git a/mathesar/tests/rpc/test_endpoints.py b/mathesar/tests/rpc/test_endpoints.py index 183ed0de50..c788da56b5 100644 --- a/mathesar/tests/rpc/test_endpoints.py +++ b/mathesar/tests/rpc/test_endpoints.py @@ -145,7 +145,7 @@ ( databases.configured.disconnect, "databases.configured.disconnect", - [user_is_authenticated] + [user_is_superuser] ), (