function _scald_user_combine_actions in Scald: Media Management made easy 7
Fetch action bitstring components for a user.
2 calls to _scald_user_combine_actions()
- scald_user_actions in ./
scald.module - Determine the Scald Actions Bitstring for a given Atom for a given User.
- scald_user_load in ./
scald.module - Implements hook_user_load().
File
- ./
scald.module, line 1181 - The Scald Core, which handles all Scald Registries and dispatch.
Code
function _scald_user_combine_actions($account) {
$scald_actions = array(
'own' => 0,
'any' => 0,
);
// Fetch action bitstring components by User Role and combine.
foreach ($account->roles as $rid => $role_name) {
$cache = cache_get('scald_actions_bitstring_for_rid_' . $rid, 'cache_scald');
if (empty($cache)) {
// On cache miss, compute the role actions.
$role_actions = scald_compute_role_actions(array(
$rid => $role_name,
));
}
else {
$role_actions = $cache->data;
}
$scald_actions['own'] |= $role_actions['own'];
$scald_actions['any'] |= $role_actions['any'];
}
// Allow operations that are allowed on any atoms to
// the user own atoms too.
$scald_actions['own'] |= $scald_actions['any'];
return $scald_actions;
}