commit d853b7d2501edeb0562394048e58bc31f34596c5 Author: Daniel Berteaud Date: Mon Nov 18 12:05:27 2013 +0100 First commit diff --git a/createlinks b/createlinks new file mode 100644 index 0000000..ca46ceb --- /dev/null +++ b/createlinks @@ -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"); +} diff --git a/ipasserelle-sondages.spec b/ipasserelle-sondages.spec new file mode 100644 index 0000000..7d45d30 --- /dev/null +++ b/ipasserelle-sondages.spec @@ -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 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) + diff --git a/root/etc/e-smith/db/configuration/defaults/limesurvey/Authentication b/root/etc/e-smith/db/configuration/defaults/limesurvey/Authentication new file mode 100644 index 0000000..dda507f --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/limesurvey/Authentication @@ -0,0 +1 @@ +LemonLDAP diff --git a/root/etc/e-smith/db/configuration/defaults/opensondage/Authentication b/root/etc/e-smith/db/configuration/defaults/opensondage/Authentication new file mode 100644 index 0000000..dda507f --- /dev/null +++ b/root/etc/e-smith/db/configuration/defaults/opensondage/Authentication @@ -0,0 +1 @@ +LemonLDAP diff --git a/root/etc/e-smith/events/actions/ipasserelle-survey-init-domains b/root/etc/e-smith/events/actions/ipasserelle-survey-init-domains new file mode 100644 index 0000000..c2ccaa9 --- /dev/null +++ b/root/etc/e-smith/events/actions/ipasserelle-survey-init-domains @@ -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"; + } +} + diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/080LimeSUrvey b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/080LimeSUrvey new file mode 100644 index 0000000..ffe461c --- /dev/null +++ b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/080LimeSUrvey @@ -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 = ''; + +} diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/080OpenSondage b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/080OpenSondage new file mode 100644 index 0000000..9ec7981 --- /dev/null +++ b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/080OpenSondage @@ -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 = ''; + +}