We regenerated with "add invoices for each client". Users signed in as tenant_user can now create and edit invoices, although we only meant them to read them.
Entity added in a regeneration is writable by every user
Common question, written up by the Supero team.
1 answer
A new entity has no rule of its own, so it gets the role's default_access. App Studio most often generates default_access="full" for tenant_admin and tenant_user, and every entity added in a later regeneration inherits that fallback rather than being denied.
Read the generated PolicyDefs and switch any role that shouldn't see everything to "none", with explicit rules:
PolicyDef(role="tenant_user", default_access="none", rules=[
PolicyRule(entity="invoice", can_read=True, can_create=False,
can_update=False, can_delete=False),
]),"none" closes create, update and delete, but reads of an entity with no rule are still allowed, so add a rule with can_read=False for anything the role mustn't read. Redeploy after the edit, then sign in as that role and call GET /api/v1/crud/{domain}/access-policy/me to see what it resolves to.
Your answer
Know the answer? Sign in to post it. It takes an email address and a 6-digit code.
Sign in to answer