You are here

shib_auth.install in Shibboleth Authentication 8

Install, update and uninstall functions for the shib_auth module.

File

shib_auth.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the shib_auth module.
 */

/**
 * Implements hook_schema().
 *
 * Defines the database tables used by this module.
 *
 * @see hook_schema()
 *
 * @ingroup shib_auth
 */
function shib_auth_schema() {
  $schema['shib_authmap'] = [
    'description' => 'Store Shibboleth User information.',
    'fields' => [
      'id' => [
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique ID.',
      ],
      'uid' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => "Creator user's {users}.uid",
      ],
      'targeted_id' => [
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
        'description' => "User's Targeted Id",
      ],
      'idp' => [
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
        'description' => "User's IDP",
      ],
      'consentver' => [
        'type' => 'varchar',
        'length' => 16,
        'not null' => FALSE,
        'default' => '',
        'description' => "User's consent version",
      ],
      'created' => [
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'description' => 'created date',
      ],
    ],
    'primary key' => [
      'id',
    ],
    'indexes' => [
      'uid' => [
        'uid',
      ],
      'targeted_id' => [
        'targeted_id',
      ],
      'idp' => [
        'idp',
      ],
      'created' => [
        'created',
      ],
    ],
  ];
  $schema['shib_auth'] = [
    'description' => 'Store Shibboleth User role information.',
    'fields' => [
      'id' => [
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'Primary Key: Unique ID.',
      ],
      'field' => [
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
        'default' => '',
        'description' => "Field",
      ],
      'regexpression' => [
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
        'default' => '',
        'description' => "Regular Expression",
      ],
      'role' => [
        'type' => 'varchar',
        'length' => 128,
        'not null' => FALSE,
        'default' => '',
        'description' => "User's consent version",
      ],
      'sitcky' => [
        'type' => 'int',
        'not null' => FALSE,
        'description' => 'Sticky Role',
      ],
    ],
    'primary key' => [
      'id',
    ],
    'indexes' => [
      'field' => [
        'field',
      ],
      'role' => [
        'role',
      ],
    ],
  ];
  return $schema;
}

/**
 * Implements hook_uninstall().
 *
 * Delete the shib_authmap and shib_auth database tables on uninstall.
 */

// Function shib_auth_uninstall(){
//  $options['target'] = 'default';
//  \Drupal\Core\Database\Database::getConnection($options['target'])->delete('shib_authmap', $options);
//  \Drupal\Core\Database\Database::getConnection($options['target'])->delete('shib_auth', $options);
// }.

Functions

Namesort descending Description
shib_auth_schema Implements hook_schema().