Browse Source

ISLANDORA-2073 block datastreams for inactive or deleted.

pull/686/head
Rosie Le Faive 7 years ago
parent
commit
a33f2df143
  1. 10
      islandora.api.php
  2. 4
      islandora.module

10
islandora.api.php

@ -562,8 +562,14 @@ function hook_cmodel_pid_islandora_ingest_steps_alter(array &$steps, array &$for
* the given object, or NULL to indicate that we are making no assertion * the given object, or NULL to indicate that we are making no assertion
* about the outcome. Can also be an array containing multiple * about the outcome. Can also be an array containing multiple
* TRUE/FALSE/NULLs, due to how hooks work. * TRUE/FALSE/NULLs, due to how hooks work.
*
* If denying an action (such as ISLANDORA_VIEW_OBJECTS) on an object,
* it will not be automatically denied for the individual datastreams.
* Operations on datastreams must be explicitly denied in
* hook_islandora_datastream_access().
*
*/ */
function hook_islandora_object_access($op, $object, $user) { function hook_islandora_object_access($op, AbstractObject $object, $user) {
switch ($op) { switch ($op) {
case 'create stuff': case 'create stuff':
return TRUE; return TRUE;
@ -602,7 +608,7 @@ function hook_cmodel_pid_islandora_object_access($op, $object, $user) {
* about the outcome. Can also be an array containing multiple * about the outcome. Can also be an array containing multiple
* TRUE/FALSE/NULLs, due to how hooks work. * TRUE/FALSE/NULLs, due to how hooks work.
*/ */
function hook_islandora_datastream_access($op, $object, $user) { function hook_islandora_datastream_access($op, AbstractObject $object, $user) {
switch ($op) { switch ($op) {
case 'create stuff': case 'create stuff':
return TRUE; return TRUE;

4
islandora.module

@ -1965,6 +1965,10 @@ function islandora_islandora_datastream_access($op, AbstractDatastream $datastre
module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/utilities');
$result = islandora_namespace_accessible($datastream->parent->id) && user_access($op, $user); $result = islandora_namespace_accessible($datastream->parent->id) && user_access($op, $user);
if (($datastream->parent->state != 'A') && variable_get('islandora_deny_inactive_and_deleted', FALSE)) {
$result = ($result && user_access(ISLANDORA_ACCESS_INACTIVE_AND_DELETED_OBJECTS, $user));
}
if ($result && $op == ISLANDORA_REGENERATE_DERIVATIVES) { if ($result && $op == ISLANDORA_REGENERATE_DERIVATIVES) {
module_load_include('inc', 'islandora', 'includes/derivatives'); module_load_include('inc', 'islandora', 'includes/derivatives');
$applicable_hook = FALSE; $applicable_hook = FALSE;

Loading…
Cancel
Save