mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #846 from kay0u/fix-permission-create
[Fix] permission create
This commit is contained in:
commit
2a5e36bd16
1 changed files with 5 additions and 11 deletions
|
@ -267,17 +267,7 @@ def permission_create(operation_logger, permission, url=None, allowed=None, sync
|
|||
except Exception as e:
|
||||
raise YunohostError('permission_creation_failed', permission=permission, error=e)
|
||||
|
||||
to_add = None
|
||||
|
||||
# If who should be allowed is explicitly provided, use this info
|
||||
if allowed:
|
||||
if not isinstance(allowed, list):
|
||||
to_add = [allowed]
|
||||
# For main permission, we add all users by default
|
||||
elif permission.endswith(".main"):
|
||||
to_add = "all_users"
|
||||
|
||||
new_permission = _update_ldap_group_permission(permission=permission, allowed=to_add, sync_perm=sync_perm)
|
||||
new_permission = _update_ldap_group_permission(permission=permission, allowed=allowed, sync_perm=sync_perm)
|
||||
|
||||
logger.debug(m18n.n('permission_created', permission=permission))
|
||||
return new_permission
|
||||
|
@ -295,6 +285,10 @@ def permission_url(operation_logger, permission, url=None, sync_perm=True):
|
|||
from yunohost.utils.ldap import _get_ldap_interface
|
||||
ldap = _get_ldap_interface()
|
||||
|
||||
# By default, manipulate main permission
|
||||
if "." not in permission:
|
||||
permission = permission + ".main"
|
||||
|
||||
# Fetch existing permission
|
||||
|
||||
existing_permission = user_permission_list(full=True)["permissions"].get(permission, None)
|
||||
|
|
Loading…
Add table
Reference in a new issue