diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-10 14:38:50 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-10 14:38:50 +0200 |
commit | a163243e3116a0cf6ca1f186b461336e3fe64e14 (patch) | |
tree | b08a9da5efbe0d37827e812c927207c6e371f98b /lib/base.php | |
parent | 75312f96d4727d8ec91a16c48ac0aca15405513f (diff) | |
parent | a33edcd2f0a74884f284166d80d23ad22b822b64 (diff) | |
download | nextcloud-server-a163243e3116a0cf6ca1f186b461336e3fe64e14.tar.gz nextcloud-server-a163243e3116a0cf6ca1f186b461336e3fe64e14.zip |
Merge pull request #15510 from owncloud/cron-singleuser
block cron when in single user mode
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/lib/base.php b/lib/base.php index 042419eff1d..74c1e8c0f42 100644 --- a/lib/base.php +++ b/lib/base.php @@ -294,27 +294,37 @@ class OC { header('Retry-After: 120'); // render error page - $tmpl = new OC_Template('', 'update.user', 'guest'); + $template = new OC_Template('', 'update.user', 'guest'); OC_Util::addscript('maintenance-check'); - $tmpl->printPage(); + $template->printPage(); die(); } } - public static function checkSingleUserMode() { + public static function checkSingleUserMode($lockIfNoUserLoggedIn = false) { + if (!\OC::$server->getSystemConfig()->getValue('singleuser', false)) { + return; + } $user = OC_User::getUserSession()->getUser(); - $group = OC_Group::getManager()->get('admin'); - if ($user && \OC::$server->getSystemConfig()->getValue('singleuser', false) && !$group->inGroup($user)) { - // send http status 503 - header('HTTP/1.1 503 Service Temporarily Unavailable'); - header('Status: 503 Service Temporarily Unavailable'); - header('Retry-After: 120'); - - // render error page - $tmpl = new OC_Template('', 'singleuser.user', 'guest'); - $tmpl->printPage(); - die(); + if ($user) { + $group = \OC::$server->getGroupManager()->get('admin'); + if ($group->inGroup($user)) { + return; + } + } else { + if(!$lockIfNoUserLoggedIn) { + return; + } } + // send http status 503 + header('HTTP/1.1 503 Service Temporarily Unavailable'); + header('Status: 503 Service Temporarily Unavailable'); + header('Retry-After: 120'); + + // render error page + $template = new OC_Template('', 'singleuser.user', 'guest'); + $template->printPage(); + die(); } /** |