user_groups: Do not allow empty group names in backend.

We now raise error if a user tries to create a group with
empty name or tries to update a group name to be empty.
This commit is contained in:
Sahil Batra
2023-09-20 15:16:52 +05:30
committed by Tim Abbott
parent 301e1c07b8
commit cb203fbe9a
2 changed files with 18 additions and 0 deletions

View File

@@ -214,6 +214,9 @@ def access_user_group_for_setting(
def check_user_group_name(group_name: str) -> str:
if group_name.strip() == "":
raise JsonableError(_("User group name can't be empty!"))
if len(group_name) > UserGroup.MAX_NAME_LENGTH:
raise JsonableError(
_("User group name cannot exceed {max_length} characters.").format(