@auth Directive to allow owner AND group
See original GitHub issue** Which Category is your question related to? ** GraphQL Transform
** What AWS Services are you utilizing? ** AWS AppSync
** Provide additional details e.g. code snippets **
I read the GraphQL Transform doc but I must have missed something. How do I use the @auth
directive to allow only the owner who is also in a group Member? So the owner can do all the queries and mutations but must belong to Member group. To put it in another way, If you belong to Member group but you are not the owner, you are not authorized to query or mutate.
type Project @model @auth(rules: [
{ allow: owner },
{ allow: groups group: ["X"] }
]) { ... }
The way I wrote above, I believe, grants owner OR Member group all the rights to every Project? So anyone that belongs to Member group can, for example, delete a Project that doesn’t belong to that person?
Thanks 👍
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
API (GraphQL) - Setup authorization rules - AWS Amplify Docs
Static group authorization allows you to protect @model types by restricting access to a known set of groups. For example, you can allow...
Read more >AWS GraphQL @auth Directive For Beginners | Geek Culture
This will allow only the owner to read, update, delete, but also allow anyone in the editors group to update and read, but...
Read more >6 GraphQL Authorization Schemas for AWS Amplify - IOD
Because the auth directive parameter accepts a rules array, it can be modeled with multiple “owner” and “group” rules. The GraphQL schema looks ......
Read more >Authentication and authorization - Apollo GraphQL Docs
Another way to go about authorization is via GraphQL Schema Directives. A directive is an identifier preceded by a @ character, optionally followed...
Read more >GraphQL Directive Permissions — Authorization Made Easy
Directive permissions are a declarative way of implementing authorization rules in GraphQL servers. In this article, our guest author Dennis ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
How do you allow read/write for owner and read only for every other authenticated user?
@mikeparisstuff any answer for @rawadrifai’s question? Consider a common use case, where there are private and public user profiles. The owner of the profile should have full access where the other authenticated users should be able to read a subset of user fields. Ideally there should be something like,