Browse Source

[enh] Patch ownCloud to config the logout URL and set it to SSOwat one

pull/4/head
Jérôme Lebleu 10 years ago
parent
commit
733d576831
  1. 2
      README.md
  2. 15
      patches/00-add-logout_url-conf.patch
  3. 6
      scripts/_common.sh
  4. 10
      scripts/install
  5. 11
      scripts/upgrade

2
README.md

@ -29,8 +29,6 @@ or from the Web administration:
## TODO
* Test the upgrade from the current official package
* Develop an app to integrate SSOwat logout - see
[here](https://doc.owncloud.org/server/9.0/developer_manual/app/hooks.html#session)
* Update the external storage plugin configuration - see
[here](https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/occ_command.html#files-external-label)
* Rescan filesystem at upgrade and restoration - see

15
patches/00-add-logout_url-conf.patch

@ -0,0 +1,15 @@
--- a/lib/base.php 2016-04-04 21:26:47.281448433 +0200
+++ b/lib/base.php 2016-04-04 21:27:16.034283534 +0200
@@ -920,8 +920,10 @@
\OC::$server->getConfig()->deleteUserValue(OC_User::getUser(), 'login_token', $_COOKIE['oc_token']);
}
OC_User::logout();
- // redirect to webroot and add slash if webroot is empty
- header("Location: " . \OC::$server->getURLGenerator()->getAbsoluteURL('/'));
+ // Use system config or redirect to webroot and add slash if webroot is empty
+ $redirect_url = $systemConfig->getValue('logout_url',
+ \OC::$server->getURLGenerator()->getAbsoluteURL('/'));
+ header("Location: " . $redirect_url);
} else {
// Redirect to default application
OC_Util::redirectToDefaultPage();

6
scripts/_common.sh

@ -46,6 +46,12 @@ extract_owncloud() {
exec_as "$AS_USER" tar xjf "$oc_tarball" -C "$DESTDIR" --strip-components 1 \
|| die "Unable to extract ownCloud tarball"
rm -f "$oc_tarball"
# apply patches
(cd "$DESTDIR" \
&& for p in ${PKGDIR}/patches/*.patch; do \
exec_as "$AS_USER" patch -p1 < $p; done) \
|| die "Unable to apply patches to ownCloud"
}
# Execute a command as another user

10
scripts/install

@ -111,6 +111,16 @@ sudo rm -f "$oc_conf"
_exec_occ ldap:test-config \'\' \
|| die "An error occured during LDAP configuration"
# Add dynamic logout URL to the config
_exec_occ config:system:get logout_url >/dev/null 2>&1 \
|| sudo su -c "echo \"
//-YunoHost-
// set logout_url according to main domain
\\\$main_domain = exec('cat /etc/yunohost/current_host');
\\\$CONFIG['logout_url'] = 'https://'.\\\$main_domain.'/yunohost/sso/?action=logout';
//-YunoHost-
\" >> ${DESTDIR}/config/config.php" -- $app
# Set the user as admin and delete admin user
ynh_mysql_connect_as $dbuser $dbpass $dbname \
<<< "INSERT INTO oc_group_user VALUES ('admin','$admin');"

11
scripts/upgrade

@ -103,6 +103,17 @@ _exec_occ app:enable user_ldap
_exec_occ config:import "$oc_conf"
sudo rm -f "$oc_conf"
# Add dynamic logout URL to the config
# TODO: if changes are made to this section, replace it with new one.
_exec_occ config:system:get logout_url >/dev/null 2>&1 \
|| sudo su -c "echo \"
//-YunoHost-
// set logout_url according to main domain
\\\$main_domain = exec('cat /etc/yunohost/current_host');
\\\$CONFIG['logout_url'] = 'https://'.\\\$main_domain.'/yunohost/sso/?action=logout';
//-YunoHost-
\" >> ${DESTDIR}/config/config.php" -- $app
# Iterate over users to extend their home folder permissions - for the external
# storage plugin usage - and create relevant ownCloud directories
for u in $(ynh_user_list); do

Loading…
Cancel
Save