You are here

function services_keyauth_schema in Services 7

Same name and namespace in other branches
  1. 6.2 auth/services_keyauth/services_keyauth.install \services_keyauth_schema()

Implements hook_schema().

File

auth/services_keyauth/services_keyauth.install, line 10
@author Services Dev Team

Code

function services_keyauth_schema() {
  $schema['services_keys'] = array(
    'description' => 'Stores all Service keys.',
    'fields' => array(
      'kid' => array(
        'description' => 'The service key ID.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'title' => array(
        'description' => 'The title of the service key.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'domain' => array(
        'description' => 'The domain of the service key.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'kid',
    ),
  );
  $schema['services_timestamp_nonce'] = array(
    'description' => 'Stores timestamp against nonce for repeat attacks.',
    'fields' => array(
      'timestamp' => array(
        'description' => 'The timestamp used with the Nonce.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'nonce' => array(
        'description' => 'The random string used on the request.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'domain' => array(
        'description' => 'The domain that submitted the request.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'timestamp' => array(
        'timestamp',
      ),
      'nonce' => array(
        'nonce',
      ),
    ),
  );
  $schema['services_key_permissions'] = array(
    'description' => 'Stores services method\'s access rights on a per API key basis.',
    'fields' => array(
      'kid' => array(
        'description' => 'The service key ID.',
        'type' => 'char',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'method' => array(
        'description' => 'Name of service method.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'indexes' => array(
      'api_key' => array(
        'kid',
      ),
      'method' => array(
        'method',
      ),
    ),
    'unique key' => array(
      'key_method' => array(
        'kid',
        'method',
      ),
    ),
  );
  return $schema;
}