You are here

function services_keyauth_schema in Services 6.2

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

Implementation of hook_schema().

File

auth/services_keyauth/services_keyauth.install, line 11
Install, uninstall and update the module.

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' => t('Stores services method\'s access rights on a per API key basis.'),
    'fields' => array(
      'kid' => array(
        'description' => t('The service key ID.'),
        'type' => 'char',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'method' => array(
        'description' => t('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;
}