Groups, ACL, and record rules
Access is four checks on every search and write. There is no separate policy language.
Groups and model rights
Groups (core.group) are the roles. A group can imply another group. Menus with groups= show only to users in those groups.
Model ACL (sys.access) is the role check for a whole model: read, write, create, unlink. Contacts ships this CSV:
id,name,model,group_id,perm_read,perm_write,perm_create,perm_unlink
access_core_partner_user,access_core_partner_user,core.partner,group_contacts_user,1,1,1,0
access_core_partner_manager,access_core_partner_manager,core.partner,group_contacts_manager,1,1,1,1
Put security/sys.access.csv in the addon and list it in manifest.json data. Settings also edits model ACL and field ACL in the UI.
Field ACL (sys.field.access) denies read or write on named fields for a group. A user who can open the model can still be blocked from one column.
Record rules
sys.rule filters rows. The domain is stored in domain_force. Tokens filled from the signed-in user:
$uid— current user id$company_id— active company$company_ids— companies that user may access
<record id="rule_order_company" model="sys.rule">
<field name="name">Orders: companies</field>
<field name="model_id" ref="model_sale_order"/>
<field name="domain_force">[["company_id", "in", "$company_ids"]]</field>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="global" eval="True"/>
</record>
Global rules combine with AND. Group rules for the same groups combine with OR, then AND with the globals. The same rules apply in the workspace and on POST /api/rpc.
Models with a stored company_id also get company isolation: a row with an empty company, or a company in $company_ids. core.company and core.user are not isolated that way. This is one database with several companies, not separate tenants.
State approval
sys.approval.rule is a separate gate: a group must approve a move from one state to another on a model. It does not replace ACL or record rules.
See also
- Record rules
- Security and access — files an addon ships
- Settings — what an administrator changes in the UI