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);
    }
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);
    }
Extract the permissions from the Contao backend user.

@param TokenInterface $token The token.

@return array