You are here

function ack_node_permission in Access Control Kit 7

Implements hook_permission().

File

ack_node/ack_node.module, line 48
The ACK node module.

Code

function ack_node_permission() {

  // Create ACK-enabled create/edit/delete permissions for each content type.
  $perms = array();
  $scheme_names = access_object_schemes('node', TRUE);
  $t_args = array(
    '%schemes' => implode(', ', $scheme_names),
  );
  foreach (node_permissions_get_configured_types() as $type) {
    $type_info = node_type_get_type($type);
    $t_args['%type'] = $type_info->name;
    $perms += array(
      "ack create {$type} content" => array(
        'title' => t('%type: Create new content in assigned access realms', $t_args),
        'description' => t('This permission only applies to the following access schemes: %schemes.', $t_args),
      ),
      "ack edit own {$type} content" => array(
        'title' => t('%type: Edit own content in assigned access realms', $t_args),
        'description' => t('This permission only applies to the following access schemes: %schemes.', $t_args),
      ),
      "ack edit any {$type} content" => array(
        'title' => t('%type: Edit any content in assigned access realms', $t_args),
        'description' => t('This permission only applies to the following access schemes: %schemes.', $t_args),
      ),
      "ack delete own {$type} content" => array(
        'title' => t('%type: Delete own content in assigned access realms', $t_args),
        'description' => t('This permission only applies to the following access schemes: %schemes.', $t_args),
      ),
      "ack delete any {$type} content" => array(
        'title' => t('%type: Delete any content in assigned access realms', $t_args),
        'description' => t('This permission only applies to the following access schemes: %schemes.', $t_args),
      ),
    );
  }
  return $perms;
}