You are here

function _pm_permission_permission_default in Drupal PM (Project Management) 7.3

Same name and namespace in other branches
  1. 8 includes/pm.permission.inc \_pm_permission_permission_default()

Helper function to generate default permissions.

Parameters

string $type: Node bundle machine name.

string $name: Node bundle name that could be used for display.

Return value

array Array equivalent to the return of hook_permission().

1 call to _pm_permission_permission_default()
pm_permission_permission_per_bundle in includes/pm.permission.inc
Creates an array of permission name for the given node bundle.

File

includes/pm.permission.inc, line 235
Main module file for the pm_permission module.

Code

function _pm_permission_permission_default($type, $name) {
  $permissions = array(
    "PM permission {$type}: create" => array(
      'title' => t('%type_name: Create new content', array(
        '%type_name' => $name,
      )),
    ),
    "PM permission {$type}: view own" => array(
      'title' => t('%type_name: View own content', array(
        '%type_name' => $name,
      )),
    ),
    "PM permission {$type}: view all" => array(
      'title' => t('%type_name: View any content', array(
        '%type_name' => $name,
      )),
    ),
    "PM permission {$type}: update own" => array(
      'title' => t('%type_name: Edit own content', array(
        '%type_name' => $name,
      )),
    ),
    "PM permission {$type}: update all" => array(
      'title' => t('%type_name: Edit any content', array(
        '%type_name' => $name,
      )),
    ),
    "PM permission {$type}: delete own" => array(
      'title' => t('%type_name: Delete own content', array(
        '%type_name' => $name,
      )),
    ),
    "PM permission {$type}: delete all" => array(
      'title' => t('%type_name: Delete any content', array(
        '%type_name' => $name,
      )),
    ),
  );
  return $permissions;
}