Skip to content
Community forum

Entity added in a regeneration is writable by every user

SolvedSupero SupportSupero team asked

Common question, written up by the Supero team.

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.

Link

1 answer

Accepted answer
Accepted 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:

python
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.

Supero Platform teamSupero team answered
Link

Your answer

Entity added in a regeneration is writable by every user | Supero Community