You are here

function workbench_access_schema in Workbench Access 7

Implements hook_schema().

File

./workbench_access.install, line 11
Install file for Workbench Access.

Code

function workbench_access_schema() {
  $schema['workbench_access'] = array(
    'description' => 'Defines the active sections for hierarchical access controls.',
    'fields' => array(
      'access_id' => array(
        'description' => 'The section identifier, which may be non-numeric.',
        'type' => 'varchar',
        'length' => '80',
        'not null' => TRUE,
        'default' => '',
      ),
      'access_scheme' => array(
        'description' => 'The module responsbile for this access system.',
        'type' => 'varchar',
        'length' => '40',
        'not null' => TRUE,
        'default' => '',
      ),
      'access_type' => array(
        'description' => 'The access type (e.g. taxonomy).',
        'type' => 'varchar',
        'length' => '40',
        'not null' => TRUE,
        'default' => '',
      ),
      'access_type_id' => array(
        'description' => 'The primary key for the access type (e.g. a vocabulary id).',
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'access_id',
      'access_scheme',
    ),
  );
  $schema['workbench_access_user'] = array(
    'description' => 'Maps user access to sections',
    'fields' => array(
      'uid' => array(
        'description' => 'The user identifier. Foreign key to {users}.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'access_id' => array(
        'description' => 'The section identifier. Foreign key to {workbench_access}.',
        'type' => 'varchar',
        'length' => '80',
        'not null' => TRUE,
        'default' => '',
      ),
      'access_scheme' => array(
        'description' => 'The module responsbile for this access system.',
        'type' => 'varchar',
        'length' => '40',
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'uid',
      'access_id',
      'access_scheme',
    ),
    'foreign keys' => array(
      'section_id' => array(
        'workbench_access' => array(
          'access_id',
          'access_scheme',
        ),
      ),
      'uid' => array(
        'users' => 'uid',
      ),
    ),
  );
  $schema['workbench_access_role'] = array(
    'description' => 'Maps role access to sections',
    'fields' => array(
      'rid' => array(
        'description' => 'The role identifier. Foreign key to {role}.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'access_id' => array(
        'description' => 'The section identifier. Foreign key to {workbench_access}.',
        'type' => 'varchar',
        'length' => '80',
        'not null' => TRUE,
        'default' => '',
      ),
      'access_scheme' => array(
        'description' => 'The module responsbile for this access system.',
        'type' => 'varchar',
        'length' => '40',
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'rid',
      'access_id',
      'access_scheme',
    ),
    'foreign keys' => array(
      'section_id' => array(
        'workbench_access' => array(
          'access_id',
          'access_scheme',
        ),
      ),
      'rid' => array(
        'role' => 'rid',
      ),
    ),
  );
  $schema['workbench_access_node'] = array(
    'description' => 'Maps sections to nodes',
    'fields' => array(
      'nid' => array(
        'description' => 'The node identifier. Foreign key to {node}.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'access_id' => array(
        'description' => 'The section identifier. Foreign key to {workbench_access}.',
        'type' => 'varchar',
        'length' => '80',
        'not null' => TRUE,
        'default' => '',
      ),
      'access_scheme' => array(
        'description' => 'The module responsbile for this access system.',
        'type' => 'varchar',
        'length' => '40',
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'nid',
      'access_id',
      'access_scheme',
    ),
    'foreign keys' => array(
      'section_id' => array(
        'workbench_access' => array(
          'access_id',
          'access_scheme',
        ),
      ),
      'uid' => array(
        'node' => 'nid',
      ),
    ),
  );
  return $schema;
}