private function extractUserRights(TokenInterface $token)
    {
        $beUser = $token->getUser();
        if (!($beUser instanceof BackendUser)) {
            return [];
        }

        $allowedModules = $beUser->modules;
        switch (true) {
            case \is_string($allowedModules):
                $allowedModules = unserialize($allowedModules, ['allowed_classes' => false]);
                break;
            case null === $allowedModules:
                $allowedModules = [];
                break;
            default:
        }
        return array_flip($allowedModules);
    }