You are here

content_permissions.module in Content Construction Kit (CCK) 6.3

File

modules/content_permissions/content_permissions.module
View source
<?php

/**
 *  Implementation of hook_perm().
 */
function content_permissions_perm() {
  $perms = array();
  foreach (content_fields() as $field) {
    $perms[] = 'edit ' . $field['field_name'];
    $perms[] = 'view ' . $field['field_name'];
  }
  return $perms;
}

/**
 * Implementation of hook_field_access().
 *
 * @see content_access().
 */
function content_permissions_field_access($op, $field, $account, $node = NULL) {
  switch ($op) {
    case 'view':
    case 'edit':
      return user_access($op . ' ' . $field['field_name'], $account);
  }
  return TRUE;
}

Functions

Namesort descending Description
content_permissions_field_access Implementation of hook_field_access().
content_permissions_perm Implementation of hook_perm().