Skip to content

Conversation

@bdunogier
Copy link
Owner

@bdunogier bdunogier commented Nov 11, 2018

Custom policies

Introduces custom policies for graphql, and applies them to limit public fields (non public fields aren't shown in the schema for the current user).

content

Restricts interaction with content, with a limitation by type. Applies to types fields inside domain content types groups.

image

image

image

Other

The _repository field will only show up for users with at least one of content/edit, class/update or role/view.

TODO

  • Rename content_type_view to content_type
  • Apply the same checks to {group}._types
  • Consider doing the same thing for a whole group. But there is no limitation for that. Show only if the user has permission on at least one item from the group ? What's the performance hit ?

The `_repository` field will only show up for users with at least one of content/edit, class/update or role/view.
Can easily be extended to more granular items.
Bertrand Dunogier added 3 commits November 11, 2018 16:24
Allows to restrict which content types a user is allowed to see over graphql.

```
DomainGroupContent:
  type: object
  fields:
    articles:
      type: "[ArticleContent]"
      public: '@=service("ezplatform_graphql.can_user").viewContentOfType("article")'
```

fixup! Custom graphql/content_type_view policy
Bertrand Dunogier added 4 commits November 11, 2018 18:41
If a relation list field is typed to one domain item, it is only visible if the user has permission for this type.
Returns the current user:

```
{
  viewer { id login }
}
```
See doc/security.md

Requires improvements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants