You are here

cas_server.install in CAS 7

Installation hooks for the CAS Server module.

File

cas_server.install
View source
<?php

/**
 * @file
 * Installation hooks for the CAS Server module.
 */

/**
 * Implements hook_schema().
 */
function cas_server_schema() {
  $schema = array();
  $schema['cas_server_tickets'] = array(
    'description' => 'Stores CAS server tickets.',
    'fields' => array(
      'service' => array(
        'type' => 'varchar',
        'length' => 1024,
        'not null' => TRUE,
        'default' => '',
      ),
      'ticket' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
      'valid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'primary key' => array(
      'ticket',
    ),
  );
  return $schema;
}

/**
 * Implements hook_uninstall().
 */
function cas_server_uninstall() {
  variable_del('cas_server_service_whitelist');
  variable_del('cas_server_whitelist_failure');
  variable_get('cas_server_slo_individual_timeout');
  variable_get('cas_server_slo_group_timeout');
}

/**
 * Creates CAS server tickets table.
 */
function cas_server_update_7000() {
  $schema = array();
  $schema['cas_server_tickets'] = array(
    'description' => 'Stores CAS server tickets.',
    'fields' => array(
      'service' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'ticket' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'uid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'timestamp' => array(
        'type' => 'int',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'ticket',
    ),
  );
  $ret = array();
  if (!db_table_exists('cas_server_tickets')) {
    db_create_table('cas_server_tickets', $schema['cas_server_tickets']);
  }
  return $ret;
}

/**
 * Adds valid field to indicate when ticket is valid for reuse.
 */
function cas_server_update_7101() {
  if (!db_field_exists('cas_server_tickets', 'valid')) {
    db_add_field('cas_server_tickets', 'valid', array(
      'type' => 'int',
      'not null' => TRUE,
      'default' => 1,
    ));
  }
}

/**
 * Increases 'service' field size to 1024.
 */
function cas_server_update_7102() {
  db_change_field('cas_server_tickets', 'service', 'service', array(
    'type' => 'varchar',
    'length' => 1024,
    'not null' => TRUE,
    'default' => '',
  ));
}

Functions

Namesort descending Description
cas_server_schema Implements hook_schema().
cas_server_uninstall Implements hook_uninstall().
cas_server_update_7000 Creates CAS server tickets table.
cas_server_update_7101 Adds valid field to indicate when ticket is valid for reuse.
cas_server_update_7102 Increases 'service' field size to 1024.