src/Security/Authorization.php
protected function parseRoles($force = false)
    {
        if (null == $this->roles || $force) {
            $user = UserManager::instance()->getuser();
            $userRoles = $user ? $user->getRoles() : ['ROLE_ANONYMOUS'];
            $roleHierarchy = Base::instance()->get('SECURITY.role_hierarchy') ?: [];
            $roles = [];

            foreach ($userRoles as $role) {
                $roles = array_merge(
                    $roles,
                    [$role],
                    $this->getHierarchy($role, $roleHierarchy)
                );
            }

            $this->roles = array_unique($roles);
        }
    }
protected function parseRoles($force = false)
    {
        if (null == $this->roles || $force) {
            $user = UserManager::instance()->getuser();
            $userRoles = $user ? $user->getRoles() : ['ROLE_ANONYMOUS'];
            $roleHierarchy = Base::instance()->get('SECURITY.role_hierarchy') ?: [];
            $roles = [];

            foreach ($userRoles as $role) {
                $roles = array_merge(
                    $roles,
                    [$role],
                    $this->getHierarchy($role, $roleHierarchy)
                );
            }

            $this->roles = array_unique($roles);
        }
    }
protected function parseRoles ( $ force = false ) { if ( null == $ this -> roles || $ force ) { $ user = UserManager :: instance ( ) -> getuser ( ) ; $ userRoles = $ user ? $ user -> getRoles ( ) : [ 'ROLE_ANONYMOUS' ] ; $ roleHierarchy = Base :: instance ( ) -> get ( 'SECURITY.role_hierarchy' ) ? : [ ] ; $ roles = [ ] ; foreach ( $ userRoles as $ role ) { $ roles = array_merge ( $ roles , [ $ role ] , $ this -> getHierarchy ( $ role , $ roleHierarchy ) ) ; } $ this -> roles = array_unique ( $ roles ) ; } }
Parse user roles
@param  boolean $force force parsing
@return void
Parse user roles