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);
        }
    }