Querying shop-specific data
Hi everyone,
I know this has been asked before, so I apologize, but I couldn’t find a definitive answer.
I was under the impression that adding the shopify-app-users action control prevents data from being shared between stores. However, does this only apply to model actions like create, update, and delete?
If I want to query data in my frontend, does it need to be explicitly linked to a shop in the model? In that case, I would need to include shop id as a filter when fetching data - am I understanding that correctly?
3 Replies
Hello,
The shopify-app-users role is only to determine who can use the specific methods. For example, if a merchant is using your app from the embedded admin ui and you have the read permission on model
foo
, merchants will be able to read foo
records. Tenancy is only applied if there's a Gelly filter on the read
permission. In the case of Shopify models, we already apply the filters for you. You can see this in the filters folder of your access controls. For custom models, you need to add the filters yourself. We recommend that custom models have a belongsTo relationship to the shop model.Aha that’s a perfect explanation! Thank you 🙏🏻
No problem! I'm going to add some more information to our docs shortly