Let's convert this in list in all cases (+ simplify later core)

This commit is contained in:
Alexandre Aubin 2019-11-29 15:51:43 +01:00
parent 32b6c2eccf
commit 9697ca8e4b

View file

@ -261,15 +261,14 @@ def permission_create(operation_logger, permission, url=None, allowed=None, sync
attr_dict['URL'] = url
if allowed is not None:
if not isinstance(allowed, list):
allowed = [allowed]
if "visitors" in allowed and "all_users" not in allowed:
if not isinstance(allowed, list):
allowed = [allowed]
allowed.append("all_users")
# Validate that the groups to add actually exist
all_existing_groups = user_group_list()['groups'].keys()
allowed_ = [] if allowed is None else [allowed] if not isinstance(allowed, list) else allowed
for group in allowed_:
for group in allowed or []:
if group not in all_existing_groups:
raise YunohostError('group_unknown', group=group)