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,28 +294,34 @@ 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() {
if (!\OC::$server->getSystemConfig()->getValue('singleuser', false)) {
return;
}
$user = OC_User::getUserSession()->getUser(); $user = OC_User::getUserSession()->getUser();
$group = OC_Group::getManager()->get('admin'); if ($user) {
if ($user && \OC::$server->getSystemConfig()->getValue('singleuser', false) && !$group->inGroup($user)) { $group = \OC::$server->getGroupManager()->get('admin');
if ($group->inGroup($user)) {
return;
}
}
// send http status 503 // send http status 503
header('HTTP/1.1 503 Service Temporarily Unavailable'); header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 120'); header('Retry-After: 120');
// render error page // render error page
$tmpl = new OC_Template('', 'singleuser.user', 'guest'); $template = new OC_Template('', 'singleuser.user', 'guest');
$tmpl->printPage(); $template->printPage();
die(); die();
} }
}
/** /**
* check if the instance needs to preform an upgrade * check if the instance needs to preform an upgrade