You are here

function workbench_moderation_recommended_permissions in Workbench Moderation 7

Same name and namespace in other branches
  1. 7.3 workbench_moderation.admin.inc \workbench_moderation_recommended_permissions()

Recommended permissions for typical moderation roles.

1 call to workbench_moderation_recommended_permissions()
workbench_moderation_admin_check_role_form_submit in ./workbench_moderation.admin.inc
Form submit handler for moderation role tests.

File

./workbench_moderation.admin.inc, line 432
Administrative functions for Workbench Moderation.

Code

function workbench_moderation_recommended_permissions($types = array()) {
  $states = workbench_moderation_states();
  $draft = workbench_moderation_state_none();
  $published = workbench_moderation_state_published();
  $permissions = array(
    'author' => array(
      // node
      "access content",
      "view own unpublished content",
      "view revisions",
      // workbench_moderation
      "view moderation messages",
      "use workbench_moderation my drafts tab",
    ),
    'editor' => array(
      // node
      "access content",
      "view revisions",
      "revert revisions",
      // workbench
      "view all unpublished content",
      // workbench_moderation
      "view moderation messages",
      "view moderation history",
      "use workbench_moderation my drafts tab",
      "use workbench_moderation needs review tab",
    ),
    'moderator' => array(
      // node
      "access content",
      "view revisions",
      // workbench
      "view all unpublished content",
      // workbench_moderation
      "view moderation messages",
      "view moderation history",
      "use workbench_moderation needs review tab",
    ),
    'publisher' => array(
      // node
      "access content",
      "view revisions",
      "revert revisions",
      // workbench
      "view all unpublished content",
      // workbench_moderation
      "view moderation messages",
      "view moderation history",
      "use workbench_moderation needs review tab",
    ),
  );
  foreach ($types as $type) {
    $permissions['author'][] = "create {$type} content";
    $permissions['author'][] = "edit own {$type} content";
    $permissions['editor'][] = "edit any {$type} content";
    $permissions['moderator'][] = "edit any {$type} content";
    $permissions['publisher'][] = "edit any {$type} content";
  }
  return $permissions;
}