public function checkForRoot()
    {
        // Don't check for root, if we're not logged in.
        if ($this->getCurrentUser() === false) {
            return false;
        }

        // Loop over the users, check if anybody's root.
        foreach ($this->getUsers() as $user) {
            if (in_array('root', $user['roles'])) {
                // We have a 'root' user.
                return true;
            }
        }

        // Make sure the DB is updated. Note, that at this point we currently don't have
        // the permissions to do so, but if we don't, update the DB, we can never add the
        // role 'root' to the current user.
        $this->app['schema']->update();

        // Show a helpful message to the user.
        $this->app['logger.flash']->info(Trans::__('general.phrase.missing-root-jackpot'));

        // If we reach this point, there is no user 'root'. We promote the current user.
        $user = $this->getCurrentUser();

        return $this->addRole($user['id'], 'root');
    }
public function checkForRoot()
    {
        // Don't check for root, if we're not logged in.
        if ($this->getCurrentUser() === false) {
            return false;
        }

        // Loop over the users, check if anybody's root.
        foreach ($this->getUsers() as $user) {
            if (in_array('root', $user['roles'])) {
                // We have a 'root' user.
                return true;
            }
        }

        // Make sure the DB is updated. Note, that at this point we currently don't have
        // the permissions to do so, but if we don't, update the DB, we can never add the
        // role 'root' to the current user.
        $this->app['schema']->update();

        // Show a helpful message to the user.
        $this->app['logger.flash']->info(Trans::__('general.phrase.missing-root-jackpot'));

        // If we reach this point, there is no user 'root'. We promote the current user.
        $user = $this->getCurrentUser();

        return $this->addRole($user['id'], 'root');
    }
public function checkForRoot ( ) { // Don't check for root, if we're not logged in. if ( $ this -> getCurrentUser ( ) === false ) { return false ; } // Loop over the users, check if anybody's root. foreach ( $ this -> getUsers ( ) as $ user ) { if ( in_array ( 'root' , $ user [ 'roles' ] ) ) { // We have a 'root' user. return true ; } } // Make sure the DB is updated. Note, that at this point we currently don't have // the permissions to do so, but if we don't, update the DB, we can never add the // role 'root' to the current user. $ this -> app [ 'schema' ] -> update ( ) ; // Show a helpful message to the user. $ this -> app [ 'logger.flash' ] -> info ( Trans :: __ ( 'general.phrase.missing-root-jackpot' ) ) ; // If we reach this point, there is no user 'root'. We promote the current user. $ user = $ this -> getCurrentUser ( ) ; return $ this -> addRole ( $ user [ 'id' ] , 'root' ) ; }
Check for a user with the 'root' role.

There should always be at least one If there isn't we promote the current
user.

@return bool
Check for a user with the root role .