Update hook_farm_access_perms() doc to demonstrate how to add a permission to farmOS roles with config access.

This commit is contained in:
Michael Stenta 2020-08-26 15:39:40 -04:00
parent c0eca7ac95
commit c2ef587ecd
1 changed files with 5 additions and 2 deletions

View File

@ -86,8 +86,11 @@ function hook_farm_access_perms($role) {
// Grant the 'view mymodule records' permission to all roles.
$perms[] = 'view mymodule records';
// Grant the 'configure mymodule' permission to Farm Managers.
if ($role == 'farm_manager') {
// Load the list of farm roles.
$roles = farm_access_roles();
// Grant the 'configure mymodule' permission to roles with config access.
if (!empty($roles[$role]['access']['config'])) {
$perms[] = 'configure mymodule';
}