summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-04-09 23:47:24 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-05-06 11:38:46 +0200
commit30ed56111050a418ce24b0b0894405910d27d0f5 (patch)
tree92a11d67ddb06610487c7c9c7ddee0006121e530 /lib
parent714ca7a3a284b73b62b334a29ba4f7911a02c1a4 (diff)
downloadnextcloud-server-30ed56111050a418ce24b0b0894405910d27d0f5.tar.gz
nextcloud-server-30ed56111050a418ce24b0b0894405910d27d0f5.zip
Fix single user check in case no user is logged in
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php32
1 files changed, 19 insertions, 13 deletions
diff --git a/lib/base.php b/lib/base.php
index 86097438d57..1caad9f8969 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -263,27 +263,33 @@ 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() {
+ 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;
+ }
}
+ // 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();
}
/**