function node_convert_check_template_permission_user in Node Convert 6
Same name and namespace in other branches
- 7 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 - node_convert_convert_action_form in ./
node_convert.module - 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 - Implementation of hook_node_operations().
File
- ./
node_convert.module, line 1014 - The node_convert module converts nodes from one type to another.
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;
}