-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate the scope when validating operations #36814
Validate the scope when validating operations #36814
Conversation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
@@ -200,6 +200,13 @@ | |||
return $scopesByOperation[$operationClass]; | |||
} | |||
|
|||
try { | |||
/** @var IOperation $operation */ | |||
$operation = $this->container->query($operationClass); |
Check notice
Code scanning / Psalm
DeprecatedMethod
$scopesByOperation[$operationClass] = []; | ||
while ($row = $result->fetch()) { | ||
$scope = new ScopeContext($row['type'], $row['value']); | ||
|
||
if (!$operation->isAvailableForScope((int) $row['type'])) { |
Check notice
Code scanning / Psalm
ArgumentTypeCoercion
|
||
$this->operations[$scopeContext->getHash()] = []; | ||
while ($row = $result->fetch()) { | ||
try { | ||
/** @var IOperation $operation */ | ||
$operation = $this->container->query($row['class']); |
Check notice
Code scanning / Psalm
DeprecatedMethod
continue; | ||
} | ||
|
||
if (!$operation->isAvailableForScope((int) $row['scope_type'])) { |
Check notice
Code scanning / Psalm
ArgumentTypeCoercion
* @throws \UnexpectedValueException | ||
*/ | ||
public function validateOperation($class, $name, array $checks, $operation, string $entity, array $events) { | ||
public function validateOperation($class, $name, array $checks, $operation, ScopeContext $scope, string $entity, array $events) { |
Check notice
Code scanning / Psalm
MissingReturnType
@@ -513,6 +539,10 @@ | |||
throw new \UnexpectedValueException($this->l->t('Operation %s is invalid', [$class])); | |||
} | |||
|
|||
if (!$instance->isAvailableForScope($scope->getScope())) { |
Check notice
Code scanning / Psalm
ArgumentTypeCoercion
Summary
TODO
Checklist