mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
fail if permission already exists
This commit is contained in:
parent
59879634da
commit
4b602f28b4
1 changed files with 4 additions and 13 deletions
|
@ -271,20 +271,11 @@ ynh_permission_create() {
|
||||||
url="None"
|
url="None"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if permission already exists
|
if [[ -n ${allowed:-} ]]; then
|
||||||
if ynh_permission_exists --permission $permission; then
|
allowed=",allowed=['${allowed//';'/"','"}']"
|
||||||
# If permission exits, update it
|
|
||||||
if [[ -n ${allowed:-} ]]; then
|
|
||||||
allowed="--add ${allowed//';'/" "}"
|
|
||||||
fi
|
|
||||||
ynh_exec_warn_less ynh_permission_update --permission $permission ${allowed:-}
|
|
||||||
else
|
|
||||||
# If not, create it
|
|
||||||
if [[ -n ${allowed:-} ]]; then
|
|
||||||
allowed=",allowed=['${allowed//';'/"','"}']"
|
|
||||||
fi
|
|
||||||
yunohost tools shell -c "from yunohost.permission import permission_create; permission_create('$app.$permission', url=$url ${allowed:-} , sync_perm=False)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
yunohost tools shell -c "from yunohost.permission import permission_create; permission_create('$app.$permission', url=$url ${allowed:-} , sync_perm=False)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove a permission for the app (note that when the app is removed all permission is automatically removed)
|
# Remove a permission for the app (note that when the app is removed all permission is automatically removed)
|
||||||
|
|
Loading…
Add table
Reference in a new issue