You are here

function gallery_assist_perm in Gallery Assist 6

Implementation of hook_perm().

File

./gallery_assist.module, line 145
Drupal content type with gallery functionality.

Code

function gallery_assist_perm() {

  // Access data for the gallery_assist conten type.
  $access = array(
    'administer gallery_assist',
    'view gallery_assist content',
    'create gallery_assist content',
    'delete own gallery_assist content',
    'delete any gallery_assist content',
    'edit own gallery_assist content',
    'edit any gallery_assist content',
    'administer gallery_assist blocks',
  );

  // Access data for content types with gallery assist assignment.
  $assignment_access = array();
  $access_holder = array();
  $types = node_get_types();
  foreach ($types as $v) {
    if (variable_get('gallery_assist_' . $v->type, 0) == 1 && $v->type != 'gallery_assist') {
      $access_holder[] = array(
        'administer gallery_assist_' . $v->type,
        'view gallery_assist_' . $v->type . ' content',
        'create gallery_assist_' . $v->type . ' content',
        'delete own gallery_assist_' . $v->type . ' content',
        'delete any gallery_assist_' . $v->type . ' content',
        'edit own gallery_assist_' . $v->type . ' content',
        'edit any gallery_assist_' . $v->type . ' content',
      );
    }
  }
  for ($i = 0; $i < count($access_holder); ++$i) {
    $access = array_merge($access, $access_holder[$i]);
  }
  return $access;
}