You are here

function taxonomy_access_schema in Taxonomy Access Control 6

Same name and namespace in other branches
  1. 7 taxonomy_access.install \taxonomy_access_schema()

Implements hook_schema().

File

./taxonomy_access.install, line 112
Install, update, and uninstall functions for Taxonomy Access Control.

Code

function taxonomy_access_schema() {
  $schema = array();
  $schema['term_access'] = array(
    'description' => t('Identifies which roles may view, update, delete, create, and list nodes with a given term.'),
    'fields' => array(
      'tid' => array(
        'description' => t('The term_data.tid this record affects.  Overrides vocabulary default in term_access_defaults.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'rid' => array(
        'description' => t("The role.rid a user must possess to gain this row's privileges on nodes for this term."),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_view' => array(
        'description' => t('Whether this role can view nodes with this term. 0=>Ignore, 1=>Allow, 2=>Deny.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_update' => array(
        'description' => t('Whether this role can edit nodes with this term. 0=>Ignore, 1=>Allow, 2=>Deny.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_delete' => array(
        'description' => t('Whether this role can delete nodes with this term. 0=>Ignore, 1=>Allow, 2=>Deny.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_create' => array(
        'description' => t('Whether this role can set this term when adding or editing a node. 0=>No, 1=>Yes.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_list' => array(
        'description' => t('Whether this role can view the name of this term on a node or in category lists. 0=>No, 1=>Yes.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'tid',
      'rid',
    ),
  );
  $schema['term_access_defaults'] = array(
    'description' => t('Sets vocabulary defaults which roles may view, update, delete, create, and list nodes with a given term. Overridden by {term_access}/'),
    'fields' => array(
      'vid' => array(
        'description' => t('The vocabulary.vid for which this row sets defaults.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'rid' => array(
        'description' => t("The role.rid a user must possess to gain this row's privileges on nodes for terms in this vocabulary."),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_view' => array(
        'description' => t('Whether this role can view nodes with terms in this vocabulary. 0=>Ignore, 1=>Allow, 2=>Deny.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_update' => array(
        'description' => t('Whether this role can edit nodes with terms in this vocabulary. 0=>Ignore, 1=>Allow, 2=>Deny.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_delete' => array(
        'description' => t('Whether this role can delete nodes with terms in this vocabulary. 0=>Ignore, 1=>Allow, 2=>Deny.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_create' => array(
        'description' => t('Whether this role can set terms in this vocabulary when adding or editing a node. 0=>No, 1=>Yes.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'grant_list' => array(
        'description' => t('Whether this role can view the name of terms in this vocabulary on a node or in category lists. 0=>No, 1=>Yes.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'vid',
      'rid',
    ),
  );
  return $schema;
}