You are here

function _pm_permission_permission_assigned in Drupal PM (Project Management) 7.3

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

Helper function to generate assigned permissions set.

Parameters

string $type: Node bundle machine name.

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

Return value

array $permissions Equivalent to the return of hook_permission().

1 call to _pm_permission_permission_assigned()
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 300
Main module file for the pm_permission module.

Code

function _pm_permission_permission_assigned($type, $name, $role) {
  $permissions["PM permission {$type}: view if {$role}"] = array(
    'title' => t('%type_name: View content if %role to %type_name', array(
      '%type_name' => $name,
      '%role' => $role,
    )),
    'description' => t('For %type_name with a user as %role, allows the user to view the %type_name.', array(
      '%type_name' => $name,
      '%role' => $role,
    )),
  );
  $permissions["PM permission {$type}: update if {$role}"] = array(
    'title' => t('%type_name: Edit content if %role to %type_name', array(
      '%type_name' => $name,
      '%role' => $role,
    )),
    'description' => t('For %type_name with a user as %role, allows the user to edit the %type_name.', array(
      '%type_name' => $name,
      '%role' => $role,
    )),
  );
  $permissions["PM permission {$type}: delete if {$role}"] = array(
    'title' => t('%type_name: Delete content if %role to %type_name', array(
      '%type_name' => $name,
      '%role' => $role,
    )),
    'description' => t('For %type_name with a user as %role, allows the user to delete the %type_name.', array(
      '%type_name' => $name,
      '%role' => $role,
    )),
  );
  return $permissions;
}