You are here

function rac_form_user_admin_permissions_alter in Role Access Control 8

Same name and namespace in other branches
  1. 8.2 rac.module \rac_form_user_admin_permissions_alter()

Implements hook_form_FORM_ID_alter().

Hide Role Access permissions from global permissions list since they have their own display.

File

./rac.module, line 124
Module providing role access relations.

Code

function rac_form_user_admin_permissions_alter(&$form, FormStateInterface &$form_state, $form_id) {
  $ops = [
    'view',
    'update',
  ];
  $roles = user_roles();
  foreach ($ops as $op) {
    foreach ($roles as $role) {
      $permission = "RAC_" . $op . "_" . $role
        ->id();
      if (isset($form['permissions'][$permission])) {
        unset($form['permissions'][$permission]);
      }
    }
  }
}