function activity_get_grants in Activity 6.2
Same name and namespace in other branches
- 7 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_access_rebuild_process in ./
activity.admin.inc - Batch API processing operation. Rebuilding Access table.
- activity_record in ./
activity.module - Implementation of a configurable Drupal action. Tokenize and record an activity message.
File
- ./
activity.module, line 761 - Primarily Drupal hooks and global API functions to manipulate activity.
Code
function activity_get_grants($record) {
// Load up any files that need to be loaded.
$api_info = activity_get_module_info();
$allowed_realms = activity_access_realms();
$modules = array();
$grants = array();
foreach ($api_info as $module => $info) {
// Count the module only if it provides a useful realm.
if (count(array_intersect(array_keys($info->realms), $allowed_realms))) {
$module_grants = module_invoke($module, 'activity_grants', $record);
if (is_array($module_grants)) {
// Only write the grants that are explictly allowed.
foreach ($module_grants as $realm => $values) {
if (in_array($realm, $allowed_realms)) {
$grants[$realm] = $values;
}
}
}
}
}
// allow other modules to override what is recorded
drupal_alter('activity_access_records', $grants, $record);
return $grants;
}