mirror of
https://github.com/YunoHost-Apps/netdata_ynh.git
synced 2024-09-03 19:46:33 +02:00
Limit access in the portal to a specified user (closes #13)
This commit is contained in:
parent
d42445eed7
commit
1701fcbdb7
2 changed files with 14 additions and 1 deletions
|
@ -50,6 +50,15 @@
|
||||||
"fr": "Est-ce une application publique ?"
|
"fr": "Est-ce une application publique ?"
|
||||||
},
|
},
|
||||||
"default": false
|
"default": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"type": "user",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose the only allowed user",
|
||||||
|
"fr": "Choisissez l'unique utilisateur autorisé"
|
||||||
|
},
|
||||||
|
"example": "johndoe"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
@ -44,6 +45,7 @@ ynh_webpath_register $app $domain $path_url
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
|
ynh_app_setting_set $app admin $admin
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -76,7 +78,7 @@ then
|
||||||
else
|
else
|
||||||
# Move prefix comment #for-subdir at end of lines
|
# Move prefix comment #for-subdir at end of lines
|
||||||
ynh_replace_string "#for-subdir\(.*\)" "\1 #for-subdir" $nginx_conf
|
ynh_replace_string "#for-subdir\(.*\)" "\1 #for-subdir" $nginx_conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -116,6 +118,8 @@ if [ $is_public -eq 1 ]; then
|
||||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Add direct access in the portal to admin only
|
||||||
|
yunohost app addaccess --users=$admin $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
Loading…
Add table
Reference in a new issue