Missing working subscription operations for read-only models
See original GitHub issueDescribe the bug Related to https://github.com/aws-amplify/amplify-cli/issues/2715 Opening this issue to provide a simple example of when I provide read permissions to all users, I do not have a way to subscribe to the data to get updates.
Amplify CLI Version
4.18.0
To Reproduce
- Allow all users to be able to read the model
type ModelReadOnly
@model
@auth(rules: [ { allow: owner, operations: [create, update, delete] } ])
{
id: ID!
description: String!
}
-
CreateMutation with owner=111
-
Query from owner=222, get back model instance with owner 111
-
There is no subscription operation which does not take in
owner
field to allow subscribing to onCreate, onUpdate, onDelete of this model instance containing owner 111 from owner 222’s perspective -
Allow all users to be able to read/update the model
type ModelReadUpdate
@model
@auth(rules: [ { allow: owner, operations: [create, delete] } ])
{
id: ID!
description: String!
}
- CreateMutation with owner=111
- Query from owner=222, get back model instance with owner 111
- onUpdate subscriptiono is now public (does not require owner field), owner 222 subscribes to onUpdate
- owner=111 does update mutation on previously created model from step 6. owner 222 gets the mutation response.
- onCreate and onDelete requires owner to be passed in, there is no way for owner 222 to get the models created and deleted by owner 111, but only updates.
Expected behavior in the first model schema, when owner 222 can read the other owners model instance, there should be a subscription that allows to get mutation events for created/updated/deleted. in the second model schema, when owner 222 can read and update the other owners model instance, there should be a way to get mutation events for created/deleted.
So there should be subscriptions which do not take in the owner field and return data for all model creations/updates/deletes
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (6 by maintainers)
@SwaySway - can you provide details if your PR is addressing this issue?
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels for those types of questions.