function pollim_permission in Poll Improved 7
Implements hook_permission().
File
- ./
pollim.module, line 112 - Module for the Pollim Entity - a starting point to create your own Entity and associated administration interface
Code
function pollim_permission() {
// We set up permisssions to manage entity types, manage all entities and the
// permissions for each individual entity
$permissions = array(
'administer pollim types' => array(
'title' => t('Administer pollim types'),
'description' => t('Create and delete fields for pollim types, and set their permissions.'),
),
'administer pollims' => array(
'title' => t('Administer pollims'),
'description' => t('Edit and delete all polls.'),
),
'view pollim polls' => array(
'title' => t('View polls'),
'description' => t('View all published polls'),
),
'vote pollim polls' => array(
'title' => t('Vote on polls'),
'description' => t('Vote on all published polls.'),
),
);
//Generate permissions per pollim
foreach (pollim_get_types() as $type) {
$type_name = check_plain($type->type);
$permissions += array(
"edit any {$type_name} pollim" => array(
'title' => t('%type_name: Edit any pollim', array(
'%type_name' => $type->label,
)),
),
"view any {$type_name} pollim" => array(
'title' => t('%type_name: View any pollim', array(
'%type_name' => $type->label,
)),
),
);
}
return $permissions;
}