You are here

function og_access_check_node_access_grants_is_needed in Organic groups 7.2

Check whether group access changed that require batch processing.

Note that batch processing is possible only when the event is triggered from the UI.

Parameters

$entity: The group entity object.

$entity_type: The group type.

Return value

bool TRUE if content permissions of group content should be rebuilt.

1 call to og_access_check_node_access_grants_is_needed()
og_access_entity_update in og_access/og_access.module
Implements hook_entity_update().

File

og_access/og_access.module, line 299
Enable access control for private and public groups and group content.

Code

function og_access_check_node_access_grants_is_needed($entity, $entity_type) {

  // Check whether group privacy change batch processing is needed.
  if (!variable_get(OG_ACCESS_PRIVACY_CHANGE_BATCH_PROCESSING, TRUE)) {
    return FALSE;
  }

  // Check if entity is the group.
  if (!og_is_group($entity_type, $entity)) {
    return FALSE;
  }

  // Check for access change.
  $context = array(
    'entity' => $entity,
    'entity_type' => $entity_type,
  );
  $result = module_invoke_all('og_access_invoke_node_access_acquire_grants', $context);
  drupal_alter('og_access_invoke_node_access_acquire_grants', $result, $context);
  return in_array(TRUE, $result);
}