function node_convert_check_template_permission_user in Node Convert 7
Same name and namespace in other branches
- 6 node_convert.module \node_convert_check_template_permission_user()
Checks if the logged in user has access to use the conversion template.
Parameters
$data: An array containing either of the following keys
- template_id The template id used for conversion
- template The template array containing data
Return value
TRUE if user can use the template, FALSE otherwise.
4 calls to node_convert_check_template_permission_user()
- node_convert_convert_action in ./
node_convert.module - Implements hook_action, exposing predefined conversion templates as actions.
- node_convert_convert_action_form in ./
node_convert.module - Node convert action form.
- node_convert_convert_nodes_using_template in ./
node_convert.module - Converts a list of nodes using a given template
- node_convert_node_operations in ./
node_convert.module - Implements hook_node_operations().
File
- ./
node_convert.module, line 456
Code
function node_convert_check_template_permission_user($data) {
if (!empty($data['template'])) {
$template = $data['template'];
}
elseif (!empty($data['template_id'])) {
$template = node_convert_load_template($data['template_id']);
}
else {
return FALSE;
}
// User with this permission can convert from/to any content type.
if (user_access('administer conversion')) {
return TRUE;
}
$access = user_access('convert from ' . $template['source_type']) && user_access('convert to ' . $template['destination_type']);
return $access;
}