wasp
wasp copied to clipboard
Allow customizing how context.user (in Operations) is obtained/populated
Imagine you can customize how that user is obtained, so that for example it is always populated with the organisation info.
Maybe the solution is to provide direct mechanism for customizing this, or maybe the solution is to provide indirect solution via Operations Middleware (which we don't have yet but should, its a future feature).
Relevant discord convo: https://discord.com/channels/686873244791210014/1353781474456768714 .
I'm super reluctant to be adding a separate db query for every page just to get organisation data for a user. Are we not simply able to change the context.user to join our "organisation" entity so we have all the information here. Basically I want an organisation to hold the subscription details not the user. And only certain actions or pages can be performed based on your subscription. Also you can only load data that is linked to your organisation.
In terms of restricting data I can do this pretty easily, just using queries, views, filters etc, but the crux is getting access within context.user or context.Org so that you don't have to do a db query everytime a page loads or a query/action is required
Buy yeah, sometihng like Operations Middleware could certainly be a soluiton to this, you could then add to context whatever you want.