You are here

simple_access.install in Simple Access 8.3

Installation for Simple Access.

File

simple_access.install
View source
<?php

/**
 * @file
 * Installation for Simple Access.
 */

/**
 * Implements hook_install().
 */
function simple_access_install() {
  module_set_weight('simple_access', 9);
  \Drupal::messenger()
    ->addMessage(t('simple access has created the required tables.'));
}

/**
 * Implements hook_schema().
 */
function simple_access_schema() {
  $schema = [];
  $schema['simple_access_node_group'] = [
    'description' => 'Define all permissions for each node',
    'fields' => [
      'nid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'gid' => [
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => 0,
      ],
      'grant_view' => [
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'grant_update' => [
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'grant_delete' => [
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'nid',
      'gid',
    ],
  ];
  $schema['simple_access_node_profile'] = [
    'fields' => [
      'nid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'pid' => [
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'nid',
      'pid',
    ],
  ];
  return $schema;
}

/**
 * Implements hook_update_last_removed().
 */
function simple_access_update_last_removed() {
  return 7202;
}