You are here

function _pmpermission_permission_belonged in Drupal PM (Project Management) 7.2

Helper function to generate belonged to permission set.

Parameters

string $type: Node bundle machine name.

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

Return value

array $permissions Array equivalent to the return of hook_permission().

1 call to _pmpermission_permission_belonged()
pmpermission_permission_per_bundle in pmpermission/pmpermission.module
Creates an array of permission name for the given node bundle.

File

pmpermission/pmpermission.module, line 318
Main module file for the pmpermission module.

Code

function _pmpermission_permission_belonged($type, $name, $belonged) {
  $permissions["PM permission {$type}: view own {$belonged}"] = array(
    'title' => t('%type_name: View content in own %belonged', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
    'description' => t('For %type_name assigned to the same %belonged as a user, allows the user to view the %type_name and see the %type_name in lists or dropdowns elsewhere on the site.', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
  );
  $permissions["PM permission {$type}: update own {$belonged}"] = array(
    'title' => t('%type_name: Edit content in own %belonged', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
    'description' => t('For %type_name assigned to the same %belonged as a user, allows the user to edit the %type_name.', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
  );
  $permissions["PM permission {$type}: delete own {$belonged}"] = array(
    'title' => t('%type_name: Delete in own %belonged', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
    'description' => t('For %type_name assigned to the same %belonged as a user, allows the user to delete the %type_name.', array(
      '%type_name' => $name,
      '%belonged' => $belonged,
    )),
  );
  return $permissions;
}