Browse Source

Merge 301be36c51 into 983f790bc7

pull/687/merge
Rosemary Le Faive 8 years ago committed by GitHub
parent
commit
91058f2293
  1. 16
      islandora.api.php
  2. 4
      islandora.module

16
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;
@ -591,8 +597,8 @@ function hook_cmodel_pid_islandora_object_access($op, $object, $user) {
* @param string $op * @param string $op
* A string define an operation to check. Should be defined via * A string define an operation to check. Should be defined via
* hook_permission(). * hook_permission().
* @param AbstractDatastream $object * @param AbstractDatastream $datastream
* An object to check the operation on. * A datastream to check the operation on.
* @param object $user * @param object $user
* A loaded user object, as the global $user variable might contain. * A loaded user object, as the global $user variable might contain.
* *
@ -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, AbstractDatastream $datastream, $user) {
switch ($op) { switch ($op) {
case 'create stuff': case 'create stuff':
return TRUE; return TRUE;
@ -620,7 +626,7 @@ function hook_islandora_datastream_access($op, $object, $user) {
* *
* @see hook_islandora_datastream_access() * @see hook_islandora_datastream_access()
*/ */
function hook_cmodel_pid_islandora_datastream_access($op, $object, $user) { function hook_cmodel_pid_islandora_datastream_access($op, $datastream, $user) {
} }

4
islandora.module

@ -1967,11 +1967,11 @@ 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) {
module_load_include('inc', 'islandora', 'includes/utilities'); $result = islandora_islandora_object_access($op, $datastream->parent, $user);
$result = islandora_namespace_accessible($datastream->parent->id) && user_access($op, $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');
module_load_include('inc', 'islandora', 'includes/utilities');
$applicable_hook = FALSE; $applicable_hook = FALSE;
$object = $datastream->parent; $object = $datastream->parent;
$hooks = islandora_invoke_hook_list(ISLANDORA_DERIVATIVE_CREATION_HOOK, $object->models, array($object)); $hooks = islandora_invoke_hook_list(ISLANDORA_DERIVATIVE_CREATION_HOOK, $object->models, array($object));

Loading…
Cancel
Save