You are here

rac.install in Role Access Control 8

Same filename and directory in other branches
  1. 8.2 rac.install

Implements hook_install()

File

rac.install
View source
<?php

/**
 * @file
 * Implements hook_install()
 */

/**
 * Install function to assign default permissions for role access.
 */
function rac_install() {
  $ops = [
    'view',
  ];
  $roles = user_roles();
  foreach ($ops as $op) {
    foreach ($roles as $role) {
      $permission = "RAC_" . $op . "_" . $role
        ->id();
      $role
        ->grantPermission($permission);
      $role
        ->save();
    }
  }
}

/**
 * Add default config for new update_unpublished setting.
 */
function rac_update_8100($sandbox) {
  \Drupal::service("config.factory")
    ->getEditable("rac.settings")
    ->set("update_unpublished", TRUE)
    ->save();
}

Functions

Namesort descending Description
rac_install Install function to assign default permissions for role access.
rac_update_8100 Add default config for new update_unpublished setting.