First commit

This commit is contained in:
Daniel Berteaud 2013-11-18 12:05:27 +01:00
commit d853b7d250
7 changed files with 173 additions and 0 deletions

7
createlinks Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
foreach my $event (qw/webapps-update ipasserelle-update bootstrap-ldap-save/){
event_link("ipasserelle-survey-init-domains", "$event", "55");
}

54
ipasserelle-sondages.spec Normal file
View File

@ -0,0 +1,54 @@
Summary: iPasserelle Survey applications
%define name ipasserelle-sondages
Name: %{name}
%define version 0.1.0
%define release 0.beta0
Version: %{version}
Release: %{release}%{?dist}
License: GPLv2+
URL: http://www.ipasserelle.com/
Group: SMEserver/addon
Source: %{name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}
Requires: ipasserelle-base >= 0.1-14
Requires: smeserver-opensondage
Requires: smeserver-limesurvey
BuildRequires: e-smith-devtools
%description
Integrate survey applications
OpenSondage and Limesurvey
* Mon Nov 18 2013 Daniel Berteaud <daniel@firewall-services.com> 0.1.0-1
- initial release
%prep
%setup -q
%build
perl createlinks
%install
rm -rf $RPM_BUILD_ROOT
(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist
%clean
rm -rf $RPM_BUILD_ROOT
%pre
%preun
%post
%postun
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)

View File

@ -0,0 +1 @@
LemonLDAP

View File

@ -0,0 +1 @@
LemonLDAP

View File

@ -0,0 +1,51 @@
#!/usr/bin/perl -w
use strict;
use warnings;
use esmith::DomainsDB;
use esmith::ConfigDB;
my $d = esmith::DomainsDB->open or die "Couldn't open DomainsDB\n";
my $c = esmith::ConfigDB->open_ro() or die "Couldn't open ConfigDB\n";
my $domain = $c->get('DomainName')->value;
my $vhost;
$vhost = $d->get("rdv.$domain");
if (!$vhost){
$d->new_record("rdv.$domain",{
type => 'domain',
Content => 'Primary',
Description => "OpenSondage",
Nameservers => 'internet',
TemplatePath => 'WebAppVirtualHost',
DocumentRoot => '/usr/share/opensondage',
Removable => 'yes',
Authentication => 'LemonLDAP'
});
unless ( system("/sbin/e-smith/signal-event", "domain-create", "rdv.$domain") == 0 ){
die "Failed to create domain rdv.$domain\n";
}
}
$vhost = $d->get("sondages.$domain");
if (!$vhost){
$d->new_record("sondages.$domain",{
type => 'domain',
Content => 'Primary',
Description => "LimeSurvey",
Nameservers => 'internet',
TemplatePath => 'WebAppVirtualHost',
DocumentRoot => '/usr/share/limesurvey',
Removable => 'yes',
Authentication => 'LemonLDAP'
});
unless ( system("/sbin/e-smith/signal-event", "domain-create", "sondages.$domain") == 0 ){
die "Failed to create domain sondages.$domain\n";
}
}

View File

@ -0,0 +1,30 @@
{
$conf->{'exportedHeaders'}->{"sondages.$domain"} = {
'User-Name' => '$cn',
'Auth-User' => '$uid',
'User-Email' => '$mail',
'User-Groups' => '$groups'
} unless ($conf->{'exportedHeaders'}->{"sondages.$domain"});
$conf->{'locationRules'}->{"sondages.$domain"} = {
'(?#10logout)^/(index\\.php/)?admin/authentication/sa/logout' => 'logout_app',
'(?#20admin)^/(index\\.php/)?admin' => '$groups =~ /\\bequipe|admins\\b/',
'default' => 'unprotect'
} unless ($conf->{'locationRules'}->{"sondages.$domain"});
$conf->{'applicationList'}->{'010apps'}->{'limesurvey'} = {
'options' => {
'logo' => 'survey.png',
'name' => 'Outil de sondage',
'description' => 'Limesurvey',
'uri' => "https://sondages.$domain",
'display' => 'auto'
},
'type' => 'application'
} unless ($conf->{'applicationList'}->{'010apps'}->{'limesurvey'});
$OUT = '';
}

View File

@ -0,0 +1,29 @@
{
$conf->{'exportedHeaders'}->{"rdv.$domain"} = {
'User-Name' => '$cn',
'Auth-User' => '$uid',
'User-Email' => '$mail'
} unless ($conf->{'exportedHeaders'}->{"rdv.$domain"});
$conf->{'locationRules'}->{"rdv.$domain"} = {
'(?#10admin)^/admin($|/.*)' => '$groups =~ /\\badmins\\b/',
'default' => 'unprotect',
'(?#20users)^/($|(index|adminstubs|infos_sondage)\\.php)' => '$groups =~ /\\bequipe|admins\\b/'
} unless ($conf->{'locationRules'}->{"rss.$domain"});
$conf->{'applicationList'}->{'010apps'}->{'opensondage'} = {
'options' => {
'logo' => 'rdv.png',
'name' => 'Organisation de rendez-vous',
'description' => 'OpenSondage',
'uri' => "https://rdv.$domain",
'display' => 'auto'
},
'type' => 'application'
} unless ($conf->{'applicationList'}->{'010apps'}->{'opensondage'});
$OUT = '';
}