function hook_farm_access_roles in farmOS 7
Defines farm access roles.
Return value
array Returns an array of farm access roles. The key should be a unique farm role machine name, and each should be an array of role information, including the following keys: name: The human-readable name of the role. access: An optional array of default access permissions view: Specifies what the role has access to view. Set to 'all' to allow view access to everything. Or, it can be an array of arrays keyed by entity type, with a list of bundles (or 'all'). edit: Specifies what the role has access to edit. Set to 'all' to allow edit access to everything. Or, it can be an array of arrays keyed by entity type, with a list of bundles (or 'all'). config: Boolean that specifies whether or not the role should have access to configuration. Only grant this to trusted roles.
Related topics
1 function implements hook_farm_access_roles()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- farm_access_roles_farm_access_roles in modules/
farm/ farm_access/ farm_access_roles/ farm_access_roles.farm_access.inc - Implements hook_farm_access_roles().
1 invocation of hook_farm_access_roles()
- farm_access_roles in modules/
farm/ farm_access/ farm_access.module - Load a list of farm roles.
File
- modules/
farm/ farm_access/ farm_access.api.php, line 42 - Hooks provided by farm_access.
Code
function hook_farm_access_roles() {
// Build a list of roles.
$roles = array(
'farm_manager' => array(
'name' => 'Farm Manager',
'access' => array(
'view' => 'all',
'edit' => 'all',
'config' => TRUE,
),
),
'farm_worker' => array(
'name' => 'Farm Worker',
'access' => array(
'view' => 'all',
'edit' => 'all',
),
),
'farm_viewer' => array(
'name' => 'Farm Viewer',
'access' => array(
'view' => 'all',
),
),
);
return $roles;
}