mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Let's convert this in list in all cases (+ simplify later core)
This commit is contained in:
parent
32b6c2eccf
commit
9697ca8e4b
1 changed files with 5 additions and 6 deletions
|
@ -261,15 +261,14 @@ def permission_create(operation_logger, permission, url=None, allowed=None, sync
|
||||||
attr_dict['URL'] = url
|
attr_dict['URL'] = url
|
||||||
|
|
||||||
if allowed is not None:
|
if allowed is not None:
|
||||||
if "visitors" in allowed and "all_users" not in allowed:
|
|
||||||
if not isinstance(allowed, list):
|
if not isinstance(allowed, list):
|
||||||
allowed = [allowed]
|
allowed = [allowed]
|
||||||
|
if "visitors" in allowed and "all_users" not in allowed:
|
||||||
allowed.append("all_users")
|
allowed.append("all_users")
|
||||||
|
|
||||||
# Validate that the groups to add actually exist
|
# Validate that the groups to add actually exist
|
||||||
all_existing_groups = user_group_list()['groups'].keys()
|
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 or []:
|
||||||
for group in allowed_:
|
|
||||||
if group not in all_existing_groups:
|
if group not in all_existing_groups:
|
||||||
raise YunohostError('group_unknown', group=group)
|
raise YunohostError('group_unknown', group=group)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue