|
|
|
@ -475,7 +475,7 @@ function islandora_object_access_callback($perm, $object = NULL) {
|
|
|
|
|
return FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return islandora_object_access($perm); |
|
|
|
|
return islandora_object_access($perm, $object); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -1138,8 +1138,8 @@ function islandora_file_mimetype_mapping_alter(&$mapping) {
|
|
|
|
|
* An optional loaded user object. Defaults to the global $user. |
|
|
|
|
* |
|
|
|
|
* @return bool |
|
|
|
|
* TRUE if at least one implementation of hook_islandora_object_access() returned |
|
|
|
|
* TRUE, and no implementation return FALSE; FALSE otherwise. |
|
|
|
|
* TRUE if at least one implementation of hook_islandora_object_access() |
|
|
|
|
* returned TRUE, and no implementation return FALSE; FALSE otherwise. |
|
|
|
|
*/ |
|
|
|
|
function islandora_object_access($op, $object, $user = NULL) { |
|
|
|
|
$cache = &drupal_static(__FUNCTION__); |
|
|
|
@ -1203,7 +1203,7 @@ function islandora_islandora_object_access($op, $object, $user) {
|
|
|
|
|
function islandora_datastream_access($op, $datastream, $user = NULL) { |
|
|
|
|
$cache = &drupal_static(__FUNCTION__); |
|
|
|
|
|
|
|
|
|
if (!$datastream) { |
|
|
|
|
if (!is_object($datastream)) { |
|
|
|
|
// The object could not be loaded... Presumably, we don't have |
|
|
|
|
// permission. |
|
|
|
|
return NULL; |
|
|
|
@ -1213,28 +1213,27 @@ function islandora_datastream_access($op, $datastream, $user = NULL) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Populate the cache on a miss. |
|
|
|
|
if (!isset($cache[$op][$object->id][$user->uid])) { |
|
|
|
|
if ($cache[$op][$datastream->parent->id][$datastream->id][$user->uid]) { |
|
|
|
|
module_load_include('inc', 'islandora', 'includes/utilities'); |
|
|
|
|
$object_results = islandora_invoke_hook_list('islandora_object_access', $datastream->parent->models, array( |
|
|
|
|
$op, |
|
|
|
|
$datastream->parent, |
|
|
|
|
$user, |
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
$datastream_results = islandora_invoke_hook_list('islandora_datastream_access', $datastream->parent->models, array( |
|
|
|
|
$op, |
|
|
|
|
$datastream, |
|
|
|
|
$user, |
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
// Neither the object nor the datastream check returned FALSE, and one in |
|
|
|
|
// the object or datastream checks returned TRUE. |
|
|
|
|
$cache[$op][$datastream->parent->id][$datastream->id][$user->uid] = |
|
|
|
|
!in_array(FALSE, $object_results, TRUE) && |
|
|
|
|
!in_array(FALSE, $datastream_results, TRUE) && |
|
|
|
|
(in_array(TRUE, $object_results, TRUE) || in_array(TRUE, $datastream_results, TRUE)); |
|
|
|
|
} |
|
|
|
|
if (!isset($cache[$op][$datastream->parent->id][$datastream->id][$user->uid])) { |
|
|
|
|
module_load_include('inc', 'islandora', 'includes/utilities'); |
|
|
|
|
$object_results = islandora_invoke_hook_list('islandora_object_access', $datastream->parent->models, array( |
|
|
|
|
$op, |
|
|
|
|
$datastream->parent, |
|
|
|
|
$user, |
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
$datastream_results = islandora_invoke_hook_list('islandora_datastream_access', $datastream->parent->models, array( |
|
|
|
|
$op, |
|
|
|
|
$datastream, |
|
|
|
|
$user, |
|
|
|
|
)); |
|
|
|
|
|
|
|
|
|
// Neither the object nor the datastream check returned FALSE, and one in |
|
|
|
|
// the object or datastream checks returned TRUE. |
|
|
|
|
$cache[$op][$datastream->parent->id][$datastream->id][$user->uid] = ( |
|
|
|
|
!in_array(FALSE, $object_results, TRUE) && |
|
|
|
|
!in_array(FALSE, $datastream_results, TRUE) && |
|
|
|
|
(in_array(TRUE, $object_results, TRUE) || in_array(TRUE, $datastream_results, TRUE)) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $cache[$op][$datastream->parent->id][$datastream->id][$user->uid]; |
|
|
|
|