|
|
@ -1834,15 +1834,22 @@ function islandora_islandora_metadata_display_info() { |
|
|
|
* Implements hook_islandora_datastream_access(). |
|
|
|
* Implements hook_islandora_datastream_access(). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function islandora_islandora_datastream_access($op, AbstractDatastream $datastream, $user) { |
|
|
|
function islandora_islandora_datastream_access($op, AbstractDatastream $datastream, $user) { |
|
|
|
if ($op == ISLANDORA_REGENERATE_DERIVATIVES) { |
|
|
|
module_load_include('inc', 'islandora', 'includes/utilities'); |
|
|
|
|
|
|
|
$result = islandora_namespace_accessible($datastream->parent->id) && user_access($op, $user); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($result && $op == ISLANDORA_REGENERATE_DERIVATIVES) { |
|
|
|
|
|
|
|
$applicable_hook = FALSE; |
|
|
|
$object = $datastream->parent; |
|
|
|
$object = $datastream->parent; |
|
|
|
$hooks = islandora_invoke_hook_list(ISLANDORA_DERVIATIVE_CREATION_HOOK, $object->models, array($object)); |
|
|
|
$hooks = islandora_invoke_hook_list(ISLANDORA_DERVIATIVE_CREATION_HOOK, $object->models, array($object)); |
|
|
|
foreach ($hooks as $hook) { |
|
|
|
foreach ($hooks as $hook) { |
|
|
|
if ($hook['destination_dsid'] == $datastream->id && ((isset($hook['source_dsid']) && isset($object[$hook['source_dsid']]) && islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $object[$hook['source_dsid']], $user)) || (array_key_exists('source_dsid', $hook) && $hook['source_dsid'] == NULL))) { |
|
|
|
if ($hook['destination_dsid'] == $datastream->id && ((isset($hook['source_dsid']) && isset($object[$hook['source_dsid']]) && islandora_datastream_access(ISLANDORA_VIEW_OBJECTS, $object[$hook['source_dsid']], $user)) || (array_key_exists('source_dsid', $hook) && $hook['source_dsid'] == NULL))) { |
|
|
|
return user_access(ISLANDORA_REGENERATE_DERIVATIVES); |
|
|
|
$applicable_hook = TRUE; |
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return FALSE; |
|
|
|
if (!$applicable_hook) { |
|
|
|
|
|
|
|
$result = FALSE; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return NULL; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
} |
|
|
|