Compare commits

..

2 Commits
master ... sme9

Author SHA1 Message Date
Daniel Berteaud 6f1b0be697 Spec file update 2014-04-23 09:29:12 +02:00
Daniel Berteaud 57b0df05af Fix basic auth on SME9 2014-04-23 09:28:23 +02:00
6 changed files with 44 additions and 89 deletions

View File

@ -5,7 +5,6 @@ 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,18 @@
{
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';
my $ver = $sysconfig{'ReleaseVersion'} || '8.1';
'':'Alias /limesurvey /usr/share/limesurvey';
my $auth = (($limesurvey{'Authentication'} || 'http') eq 'http') ? "AuthName \"LimeSurvey\"\n" .
" AuthType Basic\n" .
" AuthExternal pwauth\n" . (($ver =~ m/^9/) ? " AuthBasicProvider external\n":'') .
" AuthBasicProvider external\n" .
" AuthExternal pwauth\n" .
" Require valid-user\n" : '';
if ($limesurvey{'status'} eq 'enabled'){
$OUT .=<<"END";
$OUT .=<<"END"
# LimeSurvey Configuration
$alias
@ -37,24 +38,15 @@ $alias
allow from $allow
Satisfy all
</Directory>
END
if ($alias ne ''){
$OUT .=<<"END";
<LocationMatch "^/limesurvey/(index\.php/)?admin">
<Directory /usr/share/limesurvey/admin>
SSLRequireSSL on
$auth
</LocationMatch>
END
}
$OUT .=<<'END';
</Directory>
<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

@ -1,14 +0,0 @@
<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,42 +12,40 @@ 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';
}
return Array(
'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
));
}
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
);
}
EOF

View File

@ -1,10 +1,11 @@
%define name smeserver-limesurvey
%define version 0.1.10
%define version 0.1.3
%define release 1
Summary: SME server integration of limesurvey
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Epoch: 9
License: GNU GPL version 2
URL: http://www.limesurvey.org
Group: SMEserver/addon
@ -14,7 +15,7 @@ BuildArchitectures: noarch
BuildRequires: e-smith-devtools
BuildRoot: /var/tmp/%{name}-%{version}
Requires: e-smith-base
Requires: limesurvey >= 2.05.141229
Requires: limesurvey >= 2.05.131219
Requires: smeserver-webapps-common
AutoReqProv: no
@ -22,31 +23,9 @@ 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
* Wed Apr 23 2014 Daniel Berteaud <daniel@firewall-services.com> 0.1.3-1.sme
- New branch for SME9
- Fix basic auth on SME9
* Fri Dec 20 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.2-1.sme
- Adapt auth for LimeSurvey 2.05 (plugin based)
@ -70,11 +49,12 @@ rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
> %{name}-%{version}-filelist
%clean
rm -rf $RPM_BUILD_ROOT
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%postun