diff --git a/permissions_app_ynh/conf/empty b/permissions_app_ynh/conf/empty new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/permissions_app_ynh/conf/empty @@ -0,0 +1 @@ + diff --git a/permissions_app_ynh/manifest.json b/permissions_app_ynh/manifest.json new file mode 100644 index 0000000..7c3b36a --- /dev/null +++ b/permissions_app_ynh/manifest.json @@ -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" + } + ] + } +} diff --git a/permissions_app_ynh/scripts/change_url b/permissions_app_ynh/scripts/change_url new file mode 100644 index 0000000..cd35d7b --- /dev/null +++ b/permissions_app_ynh/scripts/change_url @@ -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" diff --git a/permissions_app_ynh/scripts/install b/permissions_app_ynh/scripts/install new file mode 100644 index 0000000..0c37820 --- /dev/null +++ b/permissions_app_ynh/scripts/install @@ -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 --url "$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" diff --git a/permissions_app_ynh/scripts/remove b/permissions_app_ynh/scripts/remove new file mode 100644 index 0000000..ea57cd3 --- /dev/null +++ b/permissions_app_ynh/scripts/remove @@ -0,0 +1,11 @@ +#!/bin/bash + +#================================================= +# GENERIC START +#================================================= + +# Source YunoHost helpers +source /usr/share/yunohost/helpers + +# Stop script if errors +ynh_abort_if_errors