Skip to content

Commit 553fd2a

Browse files
author
Bertrand Dunogier
committed
Added permissions check of group types with graphql/content_type_view
1 parent a4991af commit 553fd2a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

DomainContent/SchemaWorker/ContentType/AddDomainContentToDomainGroup.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public function work(array &$schema, array $args)
2828
'type' => sprintf("[%s]", $this->getContentName($contentType)),
2929
// @todo Improve description to mention that it is a collection ?
3030
'description' => isset($descriptions['eng-GB']) ? $descriptions['eng-GB'] : 'No description available',
31+
'public' => sprintf(
32+
'@=service("ezplatform_graphql.can_user").viewContentType("%s")',
33+
$contentType->identifier
34+
),
3135
'resolve' => sprintf(
3236
'@=resolver("DomainContentItemsByTypeIdentifier", ["%s", args])',
3337
$contentType->identifier
@@ -47,6 +51,10 @@ public function work(array &$schema, array $args)
4751
'type' => $this->getContentName($contentType),
4852
'description' => isset($descriptions['eng-GB']) ? $descriptions['eng-GB'] : 'No description available',
4953
'resolve' => sprintf('@=resolver("DomainContentItem", [args, "%s"])', $contentType->identifier),
54+
'public' => sprintf(
55+
'@=service("ezplatform_graphql.can_user").viewContentType("%s")',
56+
$contentType->identifier
57+
),
5058
'args' => [
5159
// @todo How do we constraint this so that it only takes an id of an item of that type ?
5260
// same approach than GlobalId ? (<type>-<id>)

0 commit comments

Comments
 (0)