From c3430611ccb628403aa487052c6b50cd0c515408 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Wed, 11 Dec 2013 18:33:15 +0100 Subject: [PATCH] Replace OpenUpload with Download Ticket Service --- ipasserelle-webapps.spec | 6 ++-- .../defaults/{openupload => dl}/AliasOnPrimary | 0 .../defaults/{openupload => dl}/Authentication | 0 root/etc/e-smith/db/configuration/migrate/90Dl | 4 +++ .../actions/ipasserelle-webapps-init-domains | 30 +++++++++++++++-- .../var/lib/lemonldap-ng/conf/lmConf/035dl | 39 ++++++++++++++++++++++ .../var/lib/lemonldap-ng/conf/lmConf/035openupload | 32 ------------------ 7 files changed, 75 insertions(+), 36 deletions(-) rename root/etc/e-smith/db/configuration/defaults/{openupload => dl}/AliasOnPrimary (100%) rename root/etc/e-smith/db/configuration/defaults/{openupload => dl}/Authentication (100%) create mode 100644 root/etc/e-smith/db/configuration/migrate/90Dl create mode 100644 root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035dl delete mode 100644 root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035openupload diff --git a/ipasserelle-webapps.spec b/ipasserelle-webapps.spec index 1e12077..9d60c6e 100644 --- a/ipasserelle-webapps.spec +++ b/ipasserelle-webapps.spec @@ -14,14 +14,16 @@ BuildArch: noarch BuildRoot: /var/tmp/%{name}-%{version} Requires: ipasserelle-base >= 0.1-14 -Requires: smeserver-lemonldap-ng >= 0.2.10 -Requires: smeserver-openupload +Requires: smeserver-lemonldap-ng >= 0.2.11 +Requires: smeserver-dl Requires: smeserver-tt-rss Requires: smeserver-pydio Requires: smeserver-ooo-headless Requires: smeserver-dokuwiki Requires: dokuwiki-plugins +Obsoletes: openupload + BuildRequires: e-smith-devtools %description diff --git a/root/etc/e-smith/db/configuration/defaults/openupload/AliasOnPrimary b/root/etc/e-smith/db/configuration/defaults/dl/AliasOnPrimary similarity index 100% rename from root/etc/e-smith/db/configuration/defaults/openupload/AliasOnPrimary rename to root/etc/e-smith/db/configuration/defaults/dl/AliasOnPrimary diff --git a/root/etc/e-smith/db/configuration/defaults/openupload/Authentication b/root/etc/e-smith/db/configuration/defaults/dl/Authentication similarity index 100% rename from root/etc/e-smith/db/configuration/defaults/openupload/Authentication rename to root/etc/e-smith/db/configuration/defaults/dl/Authentication diff --git a/root/etc/e-smith/db/configuration/migrate/90Dl b/root/etc/e-smith/db/configuration/migrate/90Dl new file mode 100644 index 0000000..b8ce485 --- /dev/null +++ b/root/etc/e-smith/db/configuration/migrate/90Dl @@ -0,0 +1,4 @@ +{ +my $uri = "https://upload.$DomainName/"; +$DB->set_prop('dl', 'Uri', $uri); +} diff --git a/root/etc/e-smith/events/actions/ipasserelle-webapps-init-domains b/root/etc/e-smith/events/actions/ipasserelle-webapps-init-domains index 3145f6c..660c1d2 100644 --- a/root/etc/e-smith/events/actions/ipasserelle-webapps-init-domains +++ b/root/etc/e-smith/events/actions/ipasserelle-webapps-init-domains @@ -36,10 +36,10 @@ if (!$vhost){ $d->new_record("upload.$domain",{ type => 'domain', Content => 'Primary', - Description => "OpenUpload", + Description => "Download Ticket Service", Nameservers => 'internet', TemplatePath => 'WebAppVirtualHost', - DocumentRoot => '/usr/share/openupload/www', + DocumentRoot => '/usr/share/dl', Removable => 'yes', Authentication => 'LemonLDAP' }); @@ -48,6 +48,32 @@ if (!$vhost){ die "Failed to create domain upload.$domain\n"; } } +elsif (($vhost->prop('DocumentRoot') || '/usr/share/openupload/www') eq '/usr/share/openupload/www'){ + $d->set_prop("upload.$domain", 'DocumentRoot', '/usr/share/dl'); + $d->set_prop("upload.$domain", 'Description', 'DL'); + unless ( system("/sbin/e-smith/signal-event", "domain-modify", "upload.$domain") == 0 ){ + die "Failed to update domain upload.$domain\n"; + } +} + +$vhost = $d->get("uploadapi.$domain"); + +if (!$vhost){ + $d->new_record("uploadapi.$domain",{ + type => 'domain', + Content => 'Primary', + Description => "Download Ticket Service API", + Nameservers => 'internet', + TemplatePath => 'WebAppVirtualHost', + DocumentRoot => '/usr/share/dl', + Removable => 'yes', + Authentication => 'LemonLDAPBasic' + }); + + unless ( system("/sbin/e-smith/signal-event", "domain-create", "uploadapi.$domain") == 0 ){ + die "Failed to create domain uploadapi.$domain\n"; + } +} $vhost = $d->get("rss.$domain"); diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035dl b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035dl new file mode 100644 index 0000000..ead1e8a --- /dev/null +++ b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035dl @@ -0,0 +1,39 @@ +{ + +# Delete OpenUpload +if ( defined($conf->{'applicationList'}->{'010apps'}->{'openupload'}) ){ + delete $conf->{'exportedHeaders'}->{"upload.$domain"}; + delete $conf->{'locationRules'}->{"upload.$domain"}; + delete $conf->{'applicationList'}->{'010apps'}->{'openupload'}; + delete $conf->{'vhostOptions'}->{"upload.$domain"}; +} + +$conf->{'exportedHeaders'}->{"upload.$domain"} = { + 'Auth-User' => '$uid', + 'User-Email' => '$mail' +} unless ($conf->{'exportedHeaders'}->{"upload.$domain"}); + +$conf->{'locationRules'}->{"upload.$domain"} = { + '(?#10Auth)^/(admin|rest)\\.php' => '$groups =~ /\\badmins\\b/', + 'default' => 'unprotect' +} unless ($conf->{'locationRules'}->{"upload.$domain"}); + +$conf->{'applicationList'}->{'010apps'}->{'dl'} = { + 'options' => { + 'logo' => 'dl.png', + 'name' => 'Fichiers temporaires', + 'description' => 'Service d\'hébergement de fichiers temporaires', + 'uri' => "https://upload.$domain", + 'display' => 'auto' + }, + 'type' => 'application' +} unless ($conf->{'applicationList'}->{'010apps'}->{'dl'}); + +$conf->{'vhostOptions'}->{"upload.$domain"} = { + 'vhostAliases' => "uploadapi.$domain", +} unless ($conf->{'vhostOptions'}->{"upload.$domain"}); + + +$OUT = ''; + +} diff --git a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035openupload b/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035openupload deleted file mode 100644 index 73e530e..0000000 --- a/root/etc/e-smith/templates/var/lib/lemonldap-ng/conf/lmConf/035openupload +++ /dev/null @@ -1,32 +0,0 @@ -{ - -$conf->{'exportedHeaders'}->{"upload.$domain"} = { - 'Auth-User' => '$uid', -} unless ($conf->{'exportedHeaders'}->{"upload.$domain"}); - -$conf->{'locationRules'}->{"upload.$domain"} = { - '(?#21login)(a|action)=login' => "logout_app https://upload.$domain/", - '(?#13unprotect_captcha)^/plugins/captcha\\.php' => 'unprotect', - '(?#14unprotect_index)^/index\\.php$' => 'unprotect', - '(?#12unprotect_templates)^/templates/' => 'unprotect', - '(?#20logout)(a|action)=logout' => "logout_app https://auth.$domain", - '(?#10unprotect_dl)(a|action)=[dgr]' => 'unprotect', - '(?#01deny_double_action)(a|action)=.*(a|action)=.*' => 'deny', - 'default' => '$groups =~ /\\b(equipe|admins)\\b/' -} unless ($conf->{'locationRules'}->{"upload.$domain"}); - -$conf->{'applicationList'}->{'010apps'}->{'openupload'} = { - 'options' => { - 'logo' => 'openupload.png', - 'name' => 'Fichiers temporaires', - 'description' => 'Service d\'hébergement de fichiers temporaires', - 'uri' => "https://upload.$domain", - 'display' => 'auto' - }, - 'type' => 'application' -} unless ($conf->{'applicationList'}->{'010apps'}->{'openupload'}); - - -$OUT = ''; - -}