You are here

function auditfiles_update_8001 in Audit Files 8.3

Same name and namespace in other branches
  1. 8.2 auditfiles.install \auditfiles_update_8001()

Provide upgrade path for permissions change from 1.x to 2.x.

File

./auditfiles.install, line 20
This file is used to write install Uninstall hooks that used in the module.

Code

function auditfiles_update_8001() {
  $roles = Role::loadMultiple();
  foreach ($roles as $roleObj) {
    if ($roleObj
      ->hasPermission('administer site configuration')) {
      $roleObj
        ->grantPermission('configure audit files reports');
      $roleObj
        ->grantPermission('access audit files reports');
      $roleObj
        ->grantPermission('access administration pages');
      $roleObj
        ->grantPermission('access site reports');
      $roleObj
        ->save();
    }
  }
}