Fix single user check in case no user is logged in

This commit is contained in:
Thomas Müller 2015-04-09 23:47:24 +02:00
parent a7aba07dc1
commit f05e19348d
1 changed files with 20 additions and 14 deletions

View File

@ -294,27 +294,33 @@ class OC {
header('Retry-After: 120'); header('Retry-After: 120');
// render error page // render error page
$tmpl = new OC_Template('', 'update.user', 'guest'); $template = new OC_Template('', 'update.user', 'guest');
OC_Util::addscript('maintenance-check'); OC_Util::addscript('maintenance-check');
$tmpl->printPage(); $template->printPage();
die(); die();
} }
} }
public static function checkSingleUserMode() { public static function checkSingleUserMode() {
$user = OC_User::getUserSession()->getUser(); if (!\OC::$server->getSystemConfig()->getValue('singleuser', false)) {
$group = OC_Group::getManager()->get('admin'); return;
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();
} }
$user = OC_User::getUserSession()->getUser();
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();
} }
/** /**