mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
realm owner: Add ability to change realm owner status of user.
This commit adds some basic checks while adding or removing realm owner status of a user and adds code to change owner status of a user using update_user_backend. This also adds restriction on removing owner status of the last owner of realm. This restriction was previously on revoking admin status, but as we have added a more privileged role of realm owner, we now have this restriction on owner instead of admin. We need to apply that restriction both in the role change code path and the deactivate code path.
This commit is contained in:
@@ -158,11 +158,11 @@ class StreamWithIDDoesNotExistError(JsonableError):
|
||||
|
||||
class CannotDeactivateLastUserError(JsonableError):
|
||||
code = ErrorCode.CANNOT_DEACTIVATE_LAST_USER
|
||||
data_fields = ['is_last_admin', 'entity']
|
||||
data_fields = ['is_last_owner', 'entity']
|
||||
|
||||
def __init__(self, is_last_admin: bool) -> None:
|
||||
self.is_last_admin = is_last_admin
|
||||
self.entity = _("organization administrator") if is_last_admin else _("user")
|
||||
def __init__(self, is_last_owner: bool) -> None:
|
||||
self.is_last_owner = is_last_owner
|
||||
self.entity = _("organization owner") if is_last_owner else _("user")
|
||||
|
||||
@staticmethod
|
||||
def msg_format() -> str:
|
||||
|
||||
Reference in New Issue
Block a user