Skip to content

Commit

Permalink
[fix] YunoHost-Apps#24 using config.php
Browse files Browse the repository at this point in the history
[fix] partially YunoHost-Apps#25 using an alt user for super-super-admin
[dev] Add a activatePlugin (to manage ls via a ynh plugin (when i done it)
[dev] Little fix on installer (warning when testing files in patch directory)
[dev] Using LimeSurvey install command for installing
  • Loading branch information
shnoulle committed Feb 20, 2017
1 parent d065dbb commit b02660c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 127 deletions.
7 changes: 6 additions & 1 deletion conf/config.php.j2
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ return array(
// LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
'debug'=>0,
'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
'enableLdap'=>true
/* yunohost part */
'auth_webserver_user_map' => array( '{{ admin }}'=>'ynh_admin'),// Primary user as ynh admin
'auth_webserver_autocreate_user'=>1,
'auth_webserver_autocreate_permissions'=>array(
'superadmin' => array('create'=>true,'read'=>true,'update'=>true,'delete'=>true),
),
)
);
/* End of file config.php */
Expand Down
21 changes: 10 additions & 11 deletions conf/data.sql.j2
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
INSERT INTO `lime_plugins` (`id`, `name`, `active`) VALUES
INSERT INTO `lime_plugins` (`id`, `name`, `active`) VALUES
(2,'AuditLog',0),
(3,'oldUrlCompat',0),
(4,'ExportR',0),
(5,'Authwebserver',1),
(6,'extendedStartPage',0),
(7,'ExportSTATAxml',0),
(8,'QuickMenu',0),
(9,'AuthLDAP',0);
(9,'AuthLDAP',1);

INSERT INTO `lime_permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES
(1,'global',0,1,'superadmin',0,1,0,0,0,0),
(2,'global',0,2,'auth_ldap',0,1,0,0,0,0),
(3,'global',0,2,'surveys',1,0,0,0,0,0);


INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES
INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key`, `value`) VALUES
(1,9,NULL,NULL,'server','\"ldap:\\/\\/localhost\"'),
(2,9,NULL,NULL,'ldapport','\"\"'),
(3,9,NULL,NULL,'ldapversion','\"3\"'),
Expand All @@ -41,8 +35,13 @@ INSERT INTO `lime_plugin_settings` (`id`, `plugin_id`, `model`, `model_id`, `key

INSERT INTO `lime_settings_global` VALUES ('defaultlang','{{ language }}'),('AssetsVersion','2620');

INSERT INTO `lime_users` VALUES (1,'{{ admin }}','9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08','Administrator',0,'{{ language }}','','default','default','default',NULL,1,'2017-02-02 01:03:08',NULL);
INSERT INTO `lime_users` VALUES (2,'{{ admin }}','9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08','Administrator',0,'{{ language }}','','default','default','default',NULL,1,'2017-02-02 01:03:08',NULL);

INSERT INTO `lime_permissions` (`id`, `entity`, `entity_id`, `uid`, `permission`, `create_p`, `read_p`, `update_p`, `delete_p`, `import_p`, `export_p`) VALUES
(2,'global',0,2,'superadmin',0,1,0,0,0,0),
(3,'global',0,2,'auth_ldap',0,1,0,0,0,0),
(4,'global',0,2,'auth_webserver',0,1,0,0,0,0);

{% if is_public == "1" %}
UPDATE `lime_plugin_settings` SET value='\"0\"' WHERE `id`=21;
{% endif %}
{% endif %}
106 changes: 0 additions & 106 deletions patches/app-0001-7ca4932.patch

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ ynh_setup_source () {
fi

# Apply patches
if [ -f ${PKG_DIR}/patches/$SOURCE_ID-*.patch ]; then
if [ $(find ${PKG_DIR}/patches/ -type f -name "$SOURCE_ID-*.patch" | wc -l) ]; then
(cd "$DEST" \
&& for p in ${PKG_DIR}/patches/$SOURCE_ID-*.patch; do \
ynh_exec_as "$AS_USER" patch -p1 < $p; done) \
Expand Down
12 changes: 4 additions & 8 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,14 @@ ynh_setup_source "$local_path" "$user"

ynh_configure config.php "$local_path/application/config/config.php"

# Fill LimeSurvey database @todo replace by command action from limesurvey
sed "s/\`prefix_/\`$prefix/g" $local_path/installer/sql/create-mysql.sql > ./structure.sql
mysql -u $db_user -p$db_pwd $db_user < ./structure.sql
ynh_configure data.sql ./data.sql
mysql -u $db_user -p$db_pwd $db_user < ./data.sql

# Randomize Password user
ls_cli=$local_path/application/commands/console.php
set +x
ynh_exec_as "$user" php $ls_cli resetpassword "$admin" "$(ynh_string_random 24)"
ynh_exec_as "$user" php $ls_cli install "ynh_admin" "$(ynh_string_random 24)" "Administrator" "$admin@$domain"
set -x

# Setup^extra DB part (@todo : replace by a plugin system)
ynh_configure data.sql ./data.sql
mysql -u $db_user -p$db_pwd $db_user < ./data.sql
# Set permissions
ynh_set_default_perm $local_path
sudo chmod -R u+w $local_path/tmp
Expand Down

0 comments on commit b02660c

Please sign in to comment.