From 0d662b16e5f37324aa30e17d89d84bcb4445e49a Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 16 Jan 2015 10:57:40 +0100 Subject: [PATCH] Adapt initial permissions --- .../application/config/config.php/25ProfileHook | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/25ProfileHook b/root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/25ProfileHook index cca4d2b..a34e921 100644 --- a/root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/25ProfileHook +++ b/root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/25ProfileHook @@ -22,31 +22,31 @@ function hook_get_auth_webserver_profile(\$user_name) { else{ \$email = \$login . '\@$DomainName'; } - if ((isset(\$_SERVER['HTTP_USER_GROUPS']) && ( - in_array('admins', preg_split("/; /", \$_SERVER['HTTP_USER_GROUPS'])) || - in_array('surveyadmins', preg_split("/; /", \$_SERVER['HTTP_USER_GROUPS'])) - )) || - (\$login == "admin")){ - \$admin = 1; - } - else{ - \$admin = 0; - } return Array( 'full_name' => \$name, 'email' => \$email, 'lang' => '$lang', 'htmleditormode' => 'inline', 'templatelist' => 'default,basic,MyOrgTemplate', - 'create_survey' => 1, - 'create_user' => \$admin, - 'delete_user' => \$admin, - 'superadmin' => \$admin, - 'configurator' => \$admin, - 'manage_template' => \$admin, - 'manage_label' => \$admin ); } +function hook_get_auth_webserver_permissions(\$user_name) { + if ((isset(\$_SERVER['HTTP_USER_GROUPS']) && ( + in_array('admins', preg_split("/;\s?/", \$_SERVER['HTTP_USER_GROUPS'])) || + in_array('surveyadmins', preg_split("/;\s?/", \$_SERVER['HTTP_USER_GROUPS'])) + )) || (\$login == "admin")){ + return Array('superadmin' => Array('read'=>true)); + } + else{ + return Array('surveys' => Array( + 'create'=>true, + 'read'=>true, + 'update'=>true, + 'delete'=>true + )); + } +} + EOF }