1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/duniter_ynh.git synced 2024-09-03 18:26:35 +02:00

[mod] Rework permission: Add BMA and WS2P accesses to visitors

Fix: Remove admin permission deletion which prevent initial installation
Check if the admin and apis permissions do not exist before creating them.
Better cmds for legacy permission cleaning
This commit is contained in:
Moul 2021-04-18 18:51:27 +02:00
parent 67e49bfb1e
commit a44ee9d4c8

View file

@ -31,15 +31,19 @@ CONFIGURE_DUNITER () {
} }
CONFIG_PERMISSIONS () { CONFIG_PERMISSIONS () {
# Protect senstive sub-routes to Duniter web admin interface, give access to choosen admin
ynh_permission_delete --permission "admin"
ynh_permission_create --permission "admin" --url "/webui" --additional_urls "/webmin" --allowed "$admin" --label "Administration" --show_tile=true
# Remove deprecated permission system settings to remove their effects # Remove deprecated permission system settings to remove their effects
if [ ! -z "$(ynh_app_setting_get --app=$app --key=protected_uris)" ]; then if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=protected_uris ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=unprotected_uris fi
ynh_app_setting_delete --app=$app --key=redirected_urls
# Protect senstive sub-routes to Duniter web admin interface, give access to choosen admin
if ! ynh_permission_exists --permission="admin"; then
ynh_permission_create --permission "admin" --url "/webui" --additional_urls "/webmin" --allowed "$admin" --label "Administration" --show_tile=true
fi
# Set BMA and WS2P APIs accessible to visitors
if ! ynh_permission_exists --permission="apis"; then
ynh_permission_create --permission="apis" --url="/" --allowed="visitors" --show_tile=false --protected=true
fi fi
} }