You are here

function activity_get_grants in Activity 7

Same name and namespace in other branches
  1. 6.2 activity.module \activity_get_grants()

Return all the grants for a given activity.

Parameters

stdClass $record: the database record for the activity table

Return value

array The grant records for this activity

2 calls to activity_get_grants()
activity_batch_access_rebuild_process in ./activity.batch.inc
Batch API processing operation. Rebuilding Access table.
activity_save_activity in ./activity.module
Write all required db records for a new activity.

File

./activity.module, line 566
Records Activity across the site and surfaces that to Views.

Code

function activity_get_grants($record) {
  $record = (object) $record;
  $grants = array();
  $realms = activity_cache_get('realms');
  foreach ($realms as $realm_id => $information) {
    $module_grants = module_invoke($information['module'], 'activity_grants', $record);
    foreach ($module_grants as $realm => $values) {
      if (in_array($realm, array_keys($realms))) {
        $grants[$realm] = $values;
      }
    }
  }

  // allow other modules to override what is recorded
  drupal_alter('activity_access_records', $grants, $record);
  return $grants;
}