From 98d664c45d856ac9743f65ea080df3f4196460f3 Mon Sep 17 00:00:00 2001 From: TitusPiJean Date: Thu, 19 Jan 2017 19:39:02 +0100 Subject: [PATCH 1/2] Create root key for api during post-installation --- scripts/install | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/install b/scripts/install index 066a2a7..e1b7684 100644 --- a/scripts/install +++ b/scripts/install @@ -131,4 +131,13 @@ sed -i "s@YNH_FORUM_TITLE@$title@g" ../sources/configuration.yml sudo cp ../sources/configuration.yml $final_path sudo su - www-data -s /bin/bash -c "cd $final_path && php -d memory_limit=-1 flarum install -f configuration.yml" sudo rm $final_path/configuration.yml + +# Generate and add root token for user creation and deletion +roottoken=$(ynh_string_random 40) +apitablesql="CREATE TABLE IF NOT EXISTS api_keys (api_key TEXT(40) NOT NULL UNIQUE)" +rootsql="INSERT INTO api_keys VALUES ('"$roottoken"')" +ynh_mysql_execute_as_root "$apitablesql" $dbname +ynh_mysql_execute_as_root "$rootsql" $dbname +ynh_app_setting_set "$app" root_token "$roottoken" fi + From ff45b2c39b2ad09b5200666897132270e56f81a4 Mon Sep 17 00:00:00 2001 From: TitusPiJean Date: Tue, 21 Feb 2017 21:11:23 +0100 Subject: [PATCH 2/2] SSOwat integration and other improvements Closes #5, closes #12, closes #19 and closes #21 Breaks /folder nginx configuration ? --- conf/nginx.conf | 2 +- conf/nginx_root.conf | 2 +- hooks/post_user_create | 30 ++++++++++++++++++++ manifest.json | 15 ++-------- scripts/install | 64 ++++++++++++++++++++++++++++++++++++++---- 5 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 hooks/post_user_create diff --git a/conf/nginx.conf b/conf/nginx.conf index 53cc3d9..e934ffe 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -56,5 +56,5 @@ location ^~ YNH_WWW_PATH { # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + # include conf.d/yunohost_panel.conf.inc; } diff --git a/conf/nginx_root.conf b/conf/nginx_root.conf index 15ab619..23411f6 100644 --- a/conf/nginx_root.conf +++ b/conf/nginx_root.conf @@ -56,5 +56,5 @@ location ^~ / { # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + # include conf.d/yunohost_panel.conf.inc; } diff --git a/hooks/post_user_create b/hooks/post_user_create new file mode 100644 index 0000000..368de44 --- /dev/null +++ b/hooks/post_user_create @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +# Retrieve arguments +username=$1 +app=#APP# + +# Source app helpers +source /usr/share/yunohost/helpers + +domain=$(