浏览代码

makes ModuleVoter rejection more explicit

Olivier Massot 2 年之前
父节点
当前提交
d3d5aa3176
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/Security/Voter/ModuleVoter.php

+ 6 - 1
src/Security/Voter/ModuleVoter.php

@@ -59,7 +59,12 @@ class ModuleVoter extends Voter
         /** @var Organization $organization */
         $organization = $currentAccess->getOrganization();
 
-        return $this->isOrganizationHaveThisModule($organization, $module);
+        if (!$this->isOrganizationHaveThisModule($organization, $module)) {
+            throw new AccessDeniedHttpException(
+                sprintf("The organization doesn't have the module '%s'", $module)
+            );
+        }
+        return true;
     }
 
     /**