Compare commits

...

18 Commits
sme9 ... master

Author SHA1 Message Date
Daniel Berteaud 7b6cbbffac Spec file update 2017-01-04 09:57:08 +01:00
Daniel Berteaud 7399d228c6 Fix httpd template when alias is enabled 2017-01-04 09:54:01 +01:00
Daniel Berteaud 96457a300d Spec file update 2016-12-14 08:45:20 +01:00
Daniel Berteaud 6e9820bfd6 Missing semicolon 2016-12-11 21:02:43 +01:00
Daniel Berteaud 152c1d08f1 Fix httpd template error 2016-12-11 20:53:57 +01:00
Daniel Berteaud 29f2690d33 Fix LocationMatch scope when using a dedicated vhost 2016-12-11 14:20:19 +01:00
Daniel Berteaud 6fc63e7980 Spec file update 2016-12-11 14:18:23 +01:00
Daniel Berteaud 82c7e91444 Force defining hook_get_auth_webserver_profile
Or it just won't do anything
2016-04-12 16:56:42 +02:00
Daniel Berteaud 6c2188e568 Spec file udpate 2015-12-23 11:31:49 +01:00
Daniel Berteaud 7812574a48 Make sure hooks are declared just one time 2015-12-23 11:22:44 +01:00
Daniel Berteaud f5e615f5f4 Spec file update 2015-01-16 14:52:41 +01:00
Daniel Berteaud 0d486971a0 Fix the new permission hook 2015-01-16 12:11:21 +01:00
Daniel Berteaud 9321182195 SPec file update 2015-01-16 11:25:55 +01:00
Daniel Berteaud 0d662b16e5 Adapt initial permissions 2015-01-16 10:57:40 +01:00
Daniel Berteaud b805a95afd Spec file update 2014-08-13 15:34:51 +02:00
Daniel Berteaud 46f288ba57 Add templates for the main .htaccess so the RewriteBase can adapted
if the main /limesurvey alias is disabled
2014-08-13 12:12:29 +02:00
Daniel Berteaud 85cc0e73ef Fix httpd template 2014-08-13 11:29:29 +02:00
Daniel Berteaud c178946437 Make it works with both SME8 and SME9
And fix HTTP auth when not using LemonLDAP::NG
2014-08-13 10:09:26 +02:00
6 changed files with 88 additions and 37 deletions

View File

@ -5,6 +5,7 @@ use esmith::Build::CreateLinks qw(:all);
# Templates to expand
templates2events("/etc/e-smith/sql/init/limesurvey", qw(bootstrap-console-save webapps-update));
templates2events("/usr/share/limesurvey/application/config/config.php", qw(bootstrap-console-save webapps-update));
templates2events("/usr/share/limesurvey/.htaccess", qw(bootstrap-console-save webapps-update));
safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/template-begin");
safe_symlink("/etc/e-smith/templates-default/template-end-php", "root/etc/e-smith/templates/usr/share/limesurvey/application/config/config.php/template-end");

View File

@ -1,17 +1,17 @@
{
my $access = $limesurvey{'access'} || 'private';
my $allow = ($access eq 'public')?'all':"$localAccess $externalSSLAccess";
my $allow = ($access eq 'public') ? 'all' : "$localAccess $externalSSLAccess";
my $alias = (($limesurvey{'AliasOnPrimary'} || 'enabled') ne 'enabled') ?
'':'Alias /limesurvey /usr/share/limesurvey';
'' : 'Alias /limesurvey /usr/share/limesurvey';
my $ver = $sysconfig{'ReleaseVersion'} || '8.1';
my $auth = (($limesurvey{'Authentication'} || 'http') eq 'http') ? "AuthName \"LimeSurvey\"\n" .
" AuthType Basic\n" .
" AuthExternal pwauth\n" .
" AuthExternal pwauth\n" . (($ver =~ m/^9/) ? " AuthBasicProvider external\n":'') .
" Require valid-user\n" : '';
if ($limesurvey{'status'} eq 'enabled'){
$OUT .=<<"END"
$OUT .=<<"END";
# LimeSurvey Configuration
$alias
@ -37,15 +37,24 @@ $alias
allow from $allow
Satisfy all
</Directory>
<Directory /usr/share/limesurvey/admin>
END
if ($alias ne ''){
$OUT .=<<"END";
<LocationMatch "^/limesurvey/(index\.php/)?admin">
SSLRequireSSL on
$auth
</Directory>
</LocationMatch>
END
}
$OUT .=<<'END';
<DirectoryMatch "/usr/share/limesurvey/(framework|console|installer/sql|locale|application/(logs|config)|docs)">
Deny from all
</DirectoryMatch>
END
}
else{
$OUT .= "# LimeSurvey is disabled\n";

View File

@ -7,6 +7,6 @@ if (($port ne $sslport) && ($status eq 'enabled') && ($alias eq 'enabled')){
## Redirect Web Address to Secure Address
$OUT .= " RewriteRule ^/limesurvey/admin(/.*|\$) https://%{HTTP_HOST}/limesurvey/admin\$1 \[L,R\]\n";
$OUT .= " RewriteRule ^/limesurvey/index.php/admin(/.*|\$) https://%{HTTP_HOST}/limesurvey/index.php/admin\$1 \[L,R\]\n";
}
}

View File

@ -0,0 +1,14 @@
<IfModule mod_rewrite.c>
RewriteEngine on
{
my $alias = $limesurvey{'AliasOnPrimary'} || 'enabled';
if ($alias ne 'disabled'){
$OUT .= " RewriteBase /limesurvey\n";
}
else{
$OUT .= '';
}
}
RewriteCond %\{REQUEST_FILENAME\} !-f
RewriteRule . index.php
</IfModule>

View File

@ -12,41 +12,43 @@ function hook_get_auth_webserver_profile(\$user_name) {
\$login = \$_SERVER['REMOTE_USER'];
if (isset(\$_SERVER['HTTP_USER_NAME'])){
\$name = \$_SERVER['HTTP_USER_NAME'];
}
}
else{
\$name = \$login;
}
if (isset(\$_SERVER['HTTP_USER_EMAIL'])){
\$email = \$_SERVER['HTTP_USER_EMAIL'];
}
}
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
'full_name' => \$name,
'email' => \$email,
'lang' => '$lang',
'htmleditormode' => 'inline',
'templatelist' => 'default,basic,MyOrgTemplate',
);
}
if (!function_exists('hook_get_auth_webserver_permissions')){
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']))
)) || (\$user_name == "admin")){
return Array('superadmin' => Array('read'=>true));
}
else{
return Array('surveys' => Array(
'create'=>true,
'read'=>true,
'update'=>true,
'delete'=>true
));
}
}
}
EOF
}

View File

@ -1,5 +1,5 @@
%define name smeserver-limesurvey
%define version 0.1.2
%define version 0.1.10
%define release 1
Summary: SME server integration of limesurvey
Name: %{name}
@ -14,7 +14,7 @@ BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-base
Requires: limesurvey >= 2.05.131219
Requires: limesurvey >= 2.05.141229
Requires: smeserver-webapps-common
AutoReqProv: no
@ -22,6 +22,32 @@ AutoReqProv: no
Integration of LimeSurvey on SME Server
%changelog
* Wed Jan 4 2017 Daniel Berteaud <daniel@firewall-services.com> 0.1.10-1.sme
- Fix httpd template when alias is enabled
* Mon Dec 12 2016 Daniel Berteaud <daniel@firewall-services.com> 0.1.9-1.sme
- Fix syntax error introduced in previous commit
* Sun Dec 11 2016 Daniel Berteaud <daniel@firewall-services.com> 0.1.8-1.sme
- Fix LocationMatch scope when using a dedicated vhost
* Tue Apr 12 2016 Daniel Berteaud <daniel@firewall-services.com> 0.1.7-1.sme
- Always define hook_get_auth_webserver_profile function or profile
will fallback to the default one
* Wed Dec 23 2015 Daniel Berteaud <daniel@firewall-services.com> 0.1.6-1.sme
- Make sure hooks are declared just once
* Fri Jan 16 2015 Daniel Berteaud <daniel@firewall-services.com> 0.1.5-1.sme
- Fix the new permission hook
* Fri Jan 16 2015 Daniel Berteaud <daniel@firewall-services.com> 0.1.4-1.sme
- Adapt templates to the new permission system
* Wed Aug 13 2014 Daniel Berteaud <daniel@firewall-services.com> 0.1.3-1.sme
- Merge branches for SME8 and SME9
- Fix http auth when not using Lemonldap::NG
* Fri Dec 20 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.2-1.sme
- Adapt auth for LimeSurvey 2.05 (plugin based)
@ -44,12 +70,11 @@ rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
> %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%postun