Skip to content

Field permissions

Field permission keys are read and write. write controls both create and update; update inside a field permission has no effect. Module operations still use create/read/update/delete/history.

Without a fields key, field reads follow the module read permission; field writes are denied. With fields: true all fields are allowed. With a field map, omitted fields are denied. A true module permission grants all operations and fields.

In addition to module permissions, you can also set permissions per field. These permissions are applied on top of module permissions, meaning that if a user does not have permission to read a field, they will not be able to read it even if they have permission to read the module.

[{
"resource_entity": "roles",
"resource": {
"module": "roles",
"fields": {
"name": "Accountant",
"slug": "accountant",
"modules": {
"invoices": true,
"products": {
"create": false,
"read": true,
"update": false,
"delete": false,
"history": true,
"fields": {
"price": {
"read": true,
"write": false
}
}
},
"customers": {
"create": false,
"read": false,
"update": false,
"delete": false,
"history": false,
"fields": true
}
}
}
}
}]

The configuration above allows users with the Accountant role to read the price field in the products module, but not update it. All other fields in the products module are inaccessible to users with this role, as they are not explicitly allowed.