]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix single user check in case no user is logged in
authorThomas Müller <thomas.mueller@tmit.eu>
Thu, 9 Apr 2015 21:47:24 +0000 (23:47 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 6 May 2015 10:12:40 +0000 (12:12 +0200)
lib/base.php

index e74d9247c6140382c3100789b698de80fe285891..14e2b4fe1ff2c5e1a569d7ebc1d7be50544d424c 100644 (file)
@@ -254,26 +254,32 @@ class OC {
                        header('Retry-After: 120');
 
                        // render error page
-                       $tmpl = new OC_Template('', 'update.user', 'guest');
-                       $tmpl->printPage();
+                       $template = new OC_Template('', 'update.user', 'guest');
+                       $template->printPage();
                        die();
                }
        }
 
        public static function checkSingleUserMode() {
+               if (!\OCP\Config::getSystemValue('singleuser', false)) {
+                       return;
+               }
                $user = OC_User::getUserSession()->getUser();
-               $group = OC_Group::getManager()->get('admin');
-               if ($user && OC_Config::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();
        }
 
        /**