Skip to content

Treat useStrictAccess option as true by default #700

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

Merged
merged 2 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Definition/ConfigProcessor/AclConfigProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function acl(array $fields, AccessResolver $accessResolver, callab
$field['resolve'] = function ($value, $args, $context, ResolveInfo $info) use ($field, $accessChecker, $accessResolver, $defaultResolver) {
$resolverCallback = self::findFieldResolver($field, $info, $defaultResolver);

return $accessResolver->resolve($accessChecker, $resolverCallback, [$value, $args, $context, $info], $field['useStrictAccess']);
return $accessResolver->resolve($accessChecker, $resolverCallback, [$value, $args, $context, $info], $field['useStrictAccess'] ?? true);
};
}
}
Expand Down
8 changes: 1 addition & 7 deletions src/Generator/TypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
* TODO (murtukov):
* 1. Add <code> docblocks for every method
* 2. Replace hard-coded string types with constants ('object', 'input-object' etc.).
* 3. Change formatting of generated arguments.
*/
class TypeBuilder
{
Expand Down Expand Up @@ -94,9 +93,6 @@ public function __construct(ExpressionConverter $expressionConverter, string $na
Config::registerConverter($expressionConverter, ConverterInterface::TYPE_STRING);
}

/**
* TODO (murtukov). Implement file prototype to increase performance.
*/
public function build(array $config, string $type): PhpFile
{
$this->config = $config;
Expand Down Expand Up @@ -179,7 +175,7 @@ protected function buildConfigLoader(array $config): ArrowFunction
* @var string|null $description
* @var array|null $interfaces
* @var string|null $resolveType
* @var string|null $validation - only by InputType
* @var array|null $validation - only by InputType
* @var array|null $types - only by UnionType
* @var array|null $values - only by EnumType
* @var callback|null $serialize - only by CustomScalarType
Expand Down Expand Up @@ -566,8 +562,6 @@ public function buildField(array $fieldConfig /*, $fieldname */)

if (!empty($access) && is_string($access) && ExpressionLanguage::expressionContainsVar('object', $access)) {
$field->addItem('useStrictAccess', false);
} else {
$field->addItem('useStrictAccess', true);
}

if ('input-object' === $this->type && isset($validation)) {
Expand Down