You are here

function revisioning_perm in Revisioning 6.3

Same name and namespace in other branches
  1. 6.4 revisioning.module \revisioning_perm()
  2. 6 revisioning.module \revisioning_perm()

Implementation of hook_perm().

Revisioning permissions. Note that permissions to view, revert and delete revisions already exist in node.module.

File

./revisioning.module, line 63
Allows the creation and modification of pre-published as well as live content while the current revision remains unchanged and publicly visible until the changes have been reviewed by a moderator.

Code

function revisioning_perm() {
  $perms = module_exists('module_grants_monitor') ? array(
    'access Pending tab',
  ) : array();
  $perms = array_merge($perms, array(
    'view revision status messages',
    'edit revisions',
    'publish revisions',
    'unpublish current revision',
  ));

  // Add per node-type view perms in same way as edit perms of node module.
  // TOOD only do this for content types that have the "Create new revision" ticked
  foreach (node_get_types() as $type) {
    $name = check_plain($type->type);
    $perms[] = 'view revisions of own ' . $name . ' content';
    $perms[] = 'view revisions of any ' . $name . ' content';
    $perms[] = 'publish revisions of own ' . $name . ' content';
    $perms[] = 'publish revisions of any ' . $name . ' content';
  }
  return $perms;
}