You are here

function workflow_access_user_role_update in Workflow 8

Implements hook_access_ENTITY_TYPE_update().

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

File

modules/workflow_access/workflow_access.module, line 94
Provides node access permissions based on workflow states.

Code

function workflow_access_user_role_update(EntityInterface $entity) {

  // Attend user to Rebuild data, because the weight of a role
  // is the key for workflow_Access.

  /** @var \Drupal\user\RoleInterface $entity */
  if ($entity
    ->getWeight() != $entity->original
    ->getWeight()) {

    // Role's weight has changed.
    node_access_needs_rebuild(TRUE);
  }
}