mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
Iteration on permission app, now using relative urls
This commit is contained in:
parent
e7ab7ed173
commit
43ac419886
3 changed files with 25 additions and 11 deletions
|
@ -33,6 +33,19 @@
|
|||
"example": "/permissions_app",
|
||||
"default": "/permissions_app"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public application?",
|
||||
"fr": "Est-ce une application publique ?"
|
||||
},
|
||||
"help": {
|
||||
"en": "A private app will only be accessible to logged-in users",
|
||||
"fr": "Une app privée sera seulement accessible aux utilisateurs connectés"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
|
|
|
@ -10,12 +10,4 @@ source /usr/share/yunohost/helpers
|
|||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
# Retrive arguments
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path_url=$(ynh_normalize_url_path ${YNH_APP_OLD_PATH})
|
||||
domain=$YNH_APP_NEW_DOMAIN
|
||||
path_url=$(ynh_normalize_url_path ${YNH_APP_NEW_PATH})
|
||||
|
||||
ynh_permission_urls --permission "admin" --remove "$old_domain$old_path_url/admin" --add "$domain$path_url/admin"
|
||||
ynh_permission_urls --permission "dev" --remove "$old_domain$old_path_url/dev" --add "$domain$path_url/dev"
|
||||
# Nothing to do ... Permission using relative urls don't need to be changed, only the domain/path setting (handled in the core)
|
||||
|
|
|
@ -15,13 +15,22 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
||||
admin_user=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
# Check domain/path availability
|
||||
ynh_webpath_available $domain $path_url || ynh_die "$domain$path_url is not available, please use an other domain or path."
|
||||
ynh_webpath_register $app $domain $path_url
|
||||
|
||||
ynh_permission_create --permission "admin" --urls "$domain$path_url/admin"
|
||||
ynh_permission_create --permission "admin" --urls "/admin"
|
||||
ynh_permission_update --permission "admin" --add "$admin_user"
|
||||
|
||||
ynh_permission_create --permission "dev"
|
||||
ynh_permission_urls --permission "dev" --add "$domain$path_url/dev"
|
||||
ynh_permission_urls --permission "dev" --add "/dev"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
|
||||
# Make app public if necessary or protect it
|
||||
[ $is_public -eq 0 ] || ynh_permission_update --permission "main" --remove "all_users" --add "visitors"
|
||||
|
|
Loading…
Reference in a new issue