40 lines
749 B
Plaintext
40 lines
749 B
Plaintext
<?php
|
|
/**
|
|
* @file
|
|
* Farm quantity module.
|
|
*/
|
|
|
|
// Include Features code.
|
|
include_once 'farm_quantity.features.inc';
|
|
|
|
/**
|
|
* Implements hook_farm_access_perms().
|
|
*/
|
|
function farm_quantity_farm_access_perms($role) {
|
|
|
|
// Assemble a list of entity types provided by this module.
|
|
$types = array(
|
|
'taxonomy' => array(
|
|
'farm_quantity_units',
|
|
),
|
|
);
|
|
|
|
// Grant different CRUD permissions based on the role.
|
|
$perms = array();
|
|
switch ($role) {
|
|
|
|
// Farm Manager and Worker
|
|
case 'Farm Manager':
|
|
case 'Farm Worker':
|
|
$perms = farm_access_entity_perms($types);
|
|
break;
|
|
|
|
// Farm Viewer
|
|
case 'Farm Viewer':
|
|
$perms = farm_access_entity_perms($types, array('view'));
|
|
break;
|
|
}
|
|
|
|
return $perms;
|
|
}
|