mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
Merge pull request #3 from YunoHost/permission_app
Create app to check the permissions
This commit is contained in:
commit
b463916116
5 changed files with 109 additions and 0 deletions
1
permissions_app_ynh/conf/empty
Normal file
1
permissions_app_ynh/conf/empty
Normal file
|
@ -0,0 +1 @@
|
|||
|
46
permissions_app_ynh/manifest.json
Normal file
46
permissions_app_ynh/manifest.json
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "Permissions Test",
|
||||
"id": "permissions_app",
|
||||
"description": {
|
||||
"en": "Dummy app to test permissions"
|
||||
},
|
||||
"license": "GPL-3+",
|
||||
"license": "Apache-2.0",
|
||||
"maintainer": {
|
||||
"name": "Josué Tille",
|
||||
"email": "josue@tille.ch"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">> 3.3.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for permissions_app"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for permissions_app"
|
||||
},
|
||||
"example": "/permissions_app",
|
||||
"default": "/permissions_app"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Chose a admin"
|
||||
},
|
||||
"example": "johndoe"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
24
permissions_app_ynh/scripts/change_url
Normal file
24
permissions_app_ynh/scripts/change_url
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
||||
# Source YunoHost helpers
|
||||
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_del_path --app $app --permission "admin" --url "$old_domain$old_path_url/admin"
|
||||
ynh_permission_del_path --app $app --permission "dev" --url "$old_domain$old_path_url/dev"
|
||||
|
||||
ynh_permission_add_path --app $app --permission "admin" --url "$domain$path_url/admin"
|
||||
ynh_permission_add_path --app $app --permission "dev" --url "$domain$path_url/dev"
|
27
permissions_app_ynh/scripts/install
Normal file
27
permissions_app_ynh/scripts/install
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
||||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
||||
|
||||
# Retrieve arguments
|
||||
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
|
||||
|
||||
# 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 --app $app --permission "admin" --defaultdisallow --urls "$domain$path_url/admin"
|
||||
yunohost user permission add $app -p "admin" -u $admin_user
|
||||
|
||||
ynh_permission_create --app $app --permission "dev"
|
||||
ynh_permission_add_path --app $app --permission "dev" --url "$domain$path_url/dev"
|
11
permissions_app_ynh/scripts/remove
Normal file
11
permissions_app_ynh/scripts/remove
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
||||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
# Stop script if errors
|
||||
ynh_abort_if_errors
|
Loading…
Reference in a new issue