You are here

function rac_install in Role Access Control 8

Same name and namespace in other branches
  1. 8.2 rac.install \rac_install()

Install function to assign default permissions for role access.

File

./rac.install, line 11
Implements hook_install()

Code

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();
    }
  }
}