{"id":1134,"url":"https://forum.supero.dev/t/entity-added-in-a-regeneration-is-writable-by-every-user-1134","title":"Entity added in a regeneration is writable by every user","type":"question","status":"solved","category":{"slug":"app-studio","name":"App Studio & Generation"},"tags":["regenerate","access-policies"],"author":{"handle":"supero-support","name":"Supero Support","team":true},"created":"2026-12-04T02:41:05.705Z","updated":"2026-12-04T02:41:05.705Z","upvotes":0,"error_text":null,"environment":{"client":null,"sdk_version":null,"deploy_target":null},"body_markdown":"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.","answers":[{"id":"ab575690-6e87-472c-a97b-f11372974102","url":"https://forum.supero.dev/t/entity-added-in-a-regeneration-is-writable-by-every-user-1134#post-ab575690-6e87-472c-a97b-f11372974102","author":{"handle":"supero-platform","name":"Supero Platform team","team":true},"accepted":true,"official":false,"outdated":false,"sdk_version":null,"upvotes":0,"created":"2026-12-04T02:41:05.705Z","updated":"2026-12-04T02:41:05.705Z","body_markdown":"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.\n\nRead the generated `PolicyDef`s and switch any role that shouldn't see everything to `\"none\"`, with explicit rules:\n\n```python\nPolicyDef(role=\"tenant_user\", default_access=\"none\", rules=[\n    PolicyRule(entity=\"invoice\", can_read=True, can_create=False,\n               can_update=False, can_delete=False),\n]),\n```\n\n`\"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.","comments":[]}],"licence":"CC BY-SA 4.0 (code: MIT-0)"}