You are here

function tac_fields_schema in Taxonomy Access Control 6

Implements hook_schema(). Tables: {term_field_access} and {term_field_access_defaults}

File

tac_fields/tac_fields.install, line 12
Install, update, and uninstall functions for the TAC Fields module.

Code

function tac_fields_schema() {
  $schema = array();
  $schema['term_field_access'] = array(
    'description' => t('Identifies which roles may view and update certain CCK fields of nodes with a given term.'),
    'fields' => array(
      'tid' => array(
        'description' => t('The term_data.tid this record affects.  Overrides vocabulary default in {term_field_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 this field for nodes for this term."),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'field' => array(
        'description' => t('The CCK field to which this row applies.'),
        'type' => 'varchar',
        'length' => '32',
        // CCK's max fieldname length is 32 (26 plus 'field_')
        'not null' => TRUE,
        'default' => '',
      ),
      '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,
      ),
    ),
    'primary key' => array(
      'tid',
      'rid',
      'field',
    ),
  );
  $schema['term_field_access_defaults'] = array(
    'description' => t('Sets vocabulary defaults which roles may view and update certain CCK fields of nodes with a given term. Overridden by {term_field_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,
      ),
      'field' => array(
        'description' => t('The CCK field to which this row applies.'),
        'type' => 'varchar',
        'length' => '32',
        // CCK's max fieldname length is 32 (26 plus 'field_')
        'not null' => TRUE,
        'default' => '',
      ),
      '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,
      ),
    ),
    'primary key' => array(
      'vid',
      'rid',
      'field',
    ),
  );
  return $schema;
}