Forráskód Böngészése

fix the Module->getModulesByProductConfiguration method

Olivier Massot 1 éve
szülő
commit
8080bb5207
1 módosított fájl, 5 hozzáadás és 3 törlés
  1. 5 3
      src/Service/Security/Module.php

+ 5 - 3
src/Service/Security/Module.php

@@ -130,10 +130,12 @@ class Module
     {
         $opentalentProducts = $this->parameterBag->get('opentalent.products');
 
-        if (!array_key_exists($product->value, $opentalentProducts)) {
-            throw new AccessDeniedHttpException(sprintf('The product %s does not exist !', $product->value));
+        $productKey = str_replace('-', '_', $product->value);
+
+        if (!array_key_exists($productKey, $opentalentProducts)) {
+            throw new AccessDeniedHttpException(sprintf('The product %s does not exist !', $productKey));
         }
-        $productConfig = $opentalentProducts[$product->value];
+        $productConfig = $opentalentProducts[$productKey];
         $modules = $productConfig['modules'] ?? [];
 
         if (array_key_exists('extend', $productConfig)) {