mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
Add support for extended permissions
This commit is contained in:
parent
7b967f473d
commit
35ecaf1042
3 changed files with 23 additions and 5 deletions
|
@ -24,6 +24,14 @@
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "domain_2",
|
||||||
|
"type": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a second domain for permissions_app"
|
||||||
|
},
|
||||||
|
"example": "domain.org"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
|
|
|
@ -13,19 +13,23 @@ ynh_abort_if_errors
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
|
domain_2=$YNH_APP_ARG_DOMAIN_2
|
||||||
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
path_url=$(ynh_normalize_url_path $YNH_APP_ARG_PATH)
|
||||||
admin_user=$YNH_APP_ARG_ADMIN
|
admin_user=$YNH_APP_ARG_ADMIN
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
|
||||||
ynh_app_setting_set --app $app --key admin_user --value $admin_user
|
ynh_app_setting_set --app $app --key admin_user --value $admin_user
|
||||||
|
ynh_app_setting_set --app $app --key domain_2 --value $domain_2
|
||||||
|
|
||||||
# Check domain/path availability
|
# 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_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_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
ynh_permission_create --permission "admin" --url "/admin" --allowed "$admin_user" --protected true
|
ynh_permission_create --permission "admin" --url "/admin" --allowed "$admin_user" --label "Testing app admin" --protected true --show_tile true --auth_header true
|
||||||
|
ynh_permission_create --permission "dev" --url "/dev" --additional_urls "/dev2" "/otherdev" "$domain_2/" --protected false --show_tile false --auth_header false
|
||||||
ynh_permission_create --permission "dev" --url "/dev" --protected false
|
ynh_permission_create --permission "test" --protected false
|
||||||
|
ynh_permission_create --permission "trybreakssowat_1" --url "re:/break[a-z]*/" --protected false --show_tile true --auth_header true
|
||||||
|
ynh_permission_create --permission "trybreakssowat_2" --protected false --show_tile true --auth_header true
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
|
|
@ -13,10 +13,16 @@ ynh_abort_if_errors
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
admin_user=$(ynh_app_setting_get --app $app --key admin_user)
|
admin_user=$(ynh_app_setting_get --app $app --key admin_user)
|
||||||
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
||||||
|
domain_2=$(ynh_app_setting_get --app $app --key domain_2)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE PERMISSIONS
|
# UPDATE PERMISSIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_permission_update --permission admin --remove $admin_user --protected false
|
ynh_permission_update --permission admin --remove $admin_user --show_tile false --protected false
|
||||||
ynh_permission_update --permission dev --add $admin_user --protected true
|
ynh_permission_update --permission dev --add $admin_user --label "New tile" --protected true --show_tile true
|
||||||
|
|
||||||
|
ynh_permission_url --permission admin --clear_urls --auth_header false
|
||||||
|
ynh_permission_url --permission dev --remove_url "$domain_2/" --auth_header true
|
||||||
|
ynh_permission_url --permission test --url "/mytest" --add_url "/otherTest" "$domain_2/bob"
|
||||||
|
|
Loading…
Reference in a new issue