| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function isOperationAllowed(string $resourceName, string $operationName): bool |
||
| 21 | { |
||
| 22 | $user = $this->getUser(); |
||
| 23 | $resource = $this->registry->get($resourceName); |
||
| 24 | |||
| 25 | if (!$resource->hasOperation($operationName)) { |
||
| 26 | return false; |
||
| 27 | } |
||
| 28 | $operation = $resource->getOperation($operationName); |
||
| 29 | |||
| 30 | foreach ($operation->getPermissions() ?? [] as $permission) { |
||
| 31 | if (!$this->security->isGranted($permission, $user)) { |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | return true; |
||
| 37 | } |
||
| 50 |