Bolt\Users::checkForRoot PHP Метод

checkForRoot() публичный Метод

There should always be at least one If there isn't we promote the current user.
public checkForRoot ( ) : boolean
Результат boolean
    public function checkForRoot()
    {
        // Don't check for root, if we're not logged in.
        if ($this->getCurrentUsername() === 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.
        return $this->addRole($this->getCurrentUsername(), 'root');
    }