function revisioning_permission in Revisioning 7
Same name and namespace in other branches
- 8 revisioning.module \revisioning_permission()
Implements hook_permission().
Revisioning permissions. Note that permissions to view, revert and delete revisions already exist in node.module.
File
- ./
revisioning.module, line 82 - Allows content to be updated and reviewed before submitting it for publication, while the current live revision remains unchanged and publicly visible until the changes have been reviewed and found fit for publication by a moderator.
Code
function revisioning_permission() {
$edit_description = t('Also requires edit permission from either the Node or other content access module(s).');
$moderated_content_types = implode(', ', revisioning_moderated_content_types(FALSE));
$publish_description = empty($moderated_content_types) ? t('Please select one or more content types for moderation by ticking the <em>New revision in draft, pending moderation</em> <strong>Publishing option</strong> at <em>Structure >> Content types >> edit</em>.') : t('Applies to content types that are subject to moderation, i.e.: %moderated_content_types.', array(
'%moderated_content_types' => $moderated_content_types,
));
if (!empty($moderated_content_types) && variable_get('revisioning_require_update_to_publish', TRUE)) {
$publish_description .= ' <br/>' . $edit_description;
}
$permissions = array(
'view revision status messages' => array(
'title' => t('View revision status messages'),
'description' => '',
),
'edit revisions' => array(
'title' => t('Edit content revisions'),
'description' => $edit_description,
),
'publish revisions' => array(
'title' => t("Publish content revisions (of anyone's content)"),
'description' => $publish_description,
),
'unpublish current revision' => array(
'title' => t("Unpublish current revision (of anyone's content)"),
'description' => $publish_description,
),
);
// Add per node-type view permissions in same way as edit permissions of node
// module, but only for moderated content-types.
foreach (node_type_get_types() as $type) {
$machine_name = check_plain($type->type);
if (revisioning_content_is_moderated($machine_name)) {
$permissions['view revisions of own ' . $machine_name . ' content'] = array(
'title' => t('%type-name: View revisions of own content', array(
'%type-name' => $type->name,
)),
);
$permissions['view revisions of any ' . $machine_name . ' content'] = array(
'title' => t("%type-name: View revisions of anyone's content", array(
'%type-name' => $type->name,
)),
);
$permissions['publish revisions of own ' . $machine_name . ' content'] = array(
'title' => t('%type-name: Publish revisions of own content', array(
'%type-name' => $type->name,
)),
);
$permissions['publish revisions of any ' . $machine_name . ' content'] = array(
'title' => t("%type-name: Publish revisions of anyone's content", array(
'%type-name' => $type->name,
)),
);
}
}
return $permissions;
}