@ -24,15 +24,15 @@
*/
*/
// Common datastreams.
// Common datastreams.
define('DS_COMP_STREAM', 'DS-COMPOSITE-MODEL');
define('ISLANDORA_ DS_COMP_STREAM', 'DS-COMPOSITE-MODEL');
// Permissions.
// Permissions.
define('FE DORA_VIEW_OBJECTS', 'view fedora repository objects');
define('ISLAN DORA_VIEW_OBJECTS', 'view fedora repository objects');
define('FE DORA_METADATA_EDIT', 'edit fedora metadata');
define('ISLAN DORA_METADATA_EDIT', 'edit fedora metadata');
define('FE DORA_ADD_DS', 'add fedora datastreams');
define('ISLAN DORA_ADD_DS', 'add fedora datastreams');
define('FE DORA_INGEST', 'ingest fedora objects');
define('ISLAN DORA_INGEST', 'ingest fedora objects');
define('FE DORA_PURGE', 'delete fedora objects and datastreams');
define('ISLAN DORA_PURGE', 'delete fedora objects and datastreams');
define('FE DORA_MANAGE_PROPERTIES', 'manage object properties');
define('ISLAN DORA_MANAGE_PROPERTIES', 'manage object properties');
define('ISLANDORA_VIEW_DATASTREAM_HISTORY', 'view old datastream versions');
define('ISLANDORA_VIEW_DATASTREAM_HISTORY', 'view old datastream versions');
// Hooks.
// Hooks.
@ -58,6 +58,19 @@ define('ISLANDORA_DERVIATIVE_CREATION_HOOK', 'islandora_derivative');
// Autocomplete paths.
// Autocomplete paths.
define('ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE', 'islandora/autocomplete/content-models');
define('ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE', 'islandora/autocomplete/content-models');
/**
* @deprecated Constants.
*/
// @codingStandardsIgnoreStart
define('DS_COMP_STREAM', ISLANDORA_DS_COMP_STREAM);
define('FEDORA_VIEW_OBJECTS', ISLANDORA_VIEW_OBJECTS);
define('FEDORA_METADATA_EDIT', ISLANDORA_METADATA_EDIT);
define('FEDORA_ADD_DS', ISLANDORA_ADD_DS);
define('FEDORA_INGEST', ISLANDORA_INGEST);
define('FEDORA_PURGE', ISLANDORA_PURGE);
define('FEDORA_MANAGE_PROPERTIES', ISLANDORA_MANAGE_PROPERTIES);
// @codingStandardsIgnoreEnd
/**
/**
* Implements hook_menu().
* Implements hook_menu().
*
*
@ -86,7 +99,7 @@ function islandora_menu() {
'title' => 'Solution packs',
'title' => 'Solution packs',
'description' => 'Install content models and collections required by installed solution packs.',
'description' => 'Install content models and collections required by installed solution packs.',
'page callback' => 'islandora_solution_packs_admin',
'page callback' => 'islandora_solution_packs_admin',
'access arguments' => array(FE DORA_ADD_DS),
'access arguments' => array(ISLAN DORA_ADD_DS),
'file' => 'includes/solution_packs.inc',
'file' => 'includes/solution_packs.inc',
'type' => MENU_NORMAL_ITEM,
'type' => MENU_NORMAL_ITEM,
);
);
@ -94,7 +107,7 @@ function islandora_menu() {
'title' => 'Islandora Repository',
'title' => 'Islandora Repository',
'page callback' => 'islandora_view_default_object',
'page callback' => 'islandora_view_default_object',
'type' => MENU_NORMAL_ITEM,
'type' => MENU_NORMAL_ITEM,
'access arguments' => array(FE DORA_VIEW_OBJECTS),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS),
);
);
$items['islandora/object/%islandora_object'] = array(
$items['islandora/object/%islandora_object'] = array(
'title callback' => 'islandora_drupal_title',
'title callback' => 'islandora_drupal_title',
@ -103,14 +116,14 @@ function islandora_menu() {
'page arguments' => array(2),
'page arguments' => array(2),
'type' => MENU_NORMAL_ITEM,
'type' => MENU_NORMAL_ITEM,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 2),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 2),
);
);
$items['islandora/object/%islandora_object/print'] = array(
$items['islandora/object/%islandora_object/print'] = array(
'page callback' => 'islandora_printer_object',
'page callback' => 'islandora_printer_object',
'page arguments' => array(2),
'page arguments' => array(2),
'type' => MENU_NORMAL_ITEM,
'type' => MENU_NORMAL_ITEM,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 2),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 2),
);
);
$items['islandora/object/%islandora_object/view'] = array(
$items['islandora/object/%islandora_object/view'] = array(
'title' => 'View',
'title' => 'View',
@ -130,11 +143,11 @@ function islandora_menu() {
'access callback' => 'islandora_object_manage_access_callback',
'access callback' => 'islandora_object_manage_access_callback',
'access arguments' => array(
'access arguments' => array(
array(
array(
FE DORA_MANAGE_PROPERTIES,
ISLAN DORA_MANAGE_PROPERTIES,
FE DORA_METADATA_EDIT,
ISLAN DORA_METADATA_EDIT,
FE DORA_ADD_DS,
ISLAN DORA_ADD_DS,
FE DORA_PURGE,
ISLAN DORA_PURGE,
FE DORA_INGEST,
ISLAN DORA_INGEST,
), 2),
), 2),
);
);
@ -152,9 +165,9 @@ function islandora_menu() {
'access callback' => 'islandora_object_manage_access_callback',
'access callback' => 'islandora_object_manage_access_callback',
'access arguments' => array(
'access arguments' => array(
array(
array(
FE DORA_METADATA_EDIT,
ISLAN DORA_METADATA_EDIT,
FE DORA_ADD_DS,
ISLAN DORA_ADD_DS,
FE DORA_PURGE,
ISLAN DORA_PURGE,
), 2),
), 2),
'weight' => -10,
'weight' => -10,
);
);
@ -166,7 +179,7 @@ function islandora_menu() {
'page arguments' => array('islandora_object_properties_form', 2),
'page arguments' => array('islandora_object_properties_form', 2),
'type' => MENU_LOCAL_TASK,
'type' => MENU_LOCAL_TASK,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_MANAGE_PROPERTIES, 2),
'access arguments' => array(ISLAN DORA_MANAGE_PROPERTIES, 2),
'weight' => -5,
'weight' => -5,
);
);
$items['islandora/object/%islandora_object/delete'] = array(
$items['islandora/object/%islandora_object/delete'] = array(
@ -176,7 +189,7 @@ function islandora_menu() {
'page arguments' => array('islandora_delete_object_form', 2),
'page arguments' => array('islandora_delete_object_form', 2),
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_PURGE, 2),
'access arguments' => array(ISLAN DORA_PURGE, 2),
);
);
$items['islandora/object/%islandora_object/manage/datastreams/add'] = array(
$items['islandora/object/%islandora_object/manage/datastreams/add'] = array(
'title' => 'Add a datastream',
'title' => 'Add a datastream',
@ -185,7 +198,7 @@ function islandora_menu() {
'page arguments' => array('islandora_add_datastream_form', 2),
'page arguments' => array('islandora_add_datastream_form', 2),
'type' => MENU_LOCAL_ACTION,
'type' => MENU_LOCAL_ACTION,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_ADD_DS, 2),
'access arguments' => array(ISLAN DORA_ADD_DS, 2),
);
);
$items['islandora/object/%islandora_object/manage/datastreams/add/autocomplete'] = array(
$items['islandora/object/%islandora_object/manage/datastreams/add/autocomplete'] = array(
'file' => 'includes/add_datastream.form.inc',
'file' => 'includes/add_datastream.form.inc',
@ -193,7 +206,7 @@ function islandora_menu() {
'page arguments' => array(2),
'page arguments' => array(2),
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_object_access_callback',
'access callback' => 'islandora_object_access_callback',
'access arguments' => array(FE DORA_ADD_DS, 2),
'access arguments' => array(ISLAN DORA_ADD_DS, 2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream'] = array(
'title' => 'View datastream',
'title' => 'View datastream',
@ -202,7 +215,7 @@ function islandora_menu() {
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'file' => 'includes/datastream.inc',
'file' => 'includes/datastream.inc',
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 4),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
// This menu item uses token authentication in islandora_tokened_object.
// This menu item uses token authentication in islandora_tokened_object.
@ -210,7 +223,7 @@ function islandora_menu() {
'title' => 'View datastream',
'title' => 'View datastream',
'load arguments' => array('%map'),
'load arguments' => array('%map'),
'access callback' => 'islandora_object_datastream_tokened_access_callback',
'access callback' => 'islandora_object_datastream_tokened_access_callback',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 2, 4),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 2, 4),
'type' => MENU_DEFAULT_LOCAL_TASK,
'type' => MENU_DEFAULT_LOCAL_TASK,
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/download'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/download'] = array(
@ -220,7 +233,7 @@ function islandora_menu() {
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'file' => 'includes/datastream.inc',
'file' => 'includes/datastream.inc',
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 4),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/edit'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/edit'] = array(
@ -230,7 +243,7 @@ function islandora_menu() {
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'file' => 'includes/datastream.inc',
'file' => 'includes/datastream.inc',
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_METADATA_EDIT, 4),
'access arguments' => array(ISLAN DORA_METADATA_EDIT, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/delete'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/delete'] = array(
@ -240,7 +253,7 @@ function islandora_menu() {
'file' => 'includes/delete_datastream.form.inc',
'file' => 'includes/delete_datastream.form.inc',
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_PURGE, 4),
'access arguments' => array(ISLAN DORA_PURGE, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version'] = array(
@ -260,7 +273,7 @@ function islandora_menu() {
'file' => 'includes/datastream.version.inc',
'file' => 'includes/datastream.version.inc',
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_datastream_access',
'access callback' => 'islandora_datastream_access',
'access arguments' => array(FE DORA_PURGE, 4),
'access arguments' => array(ISLAN DORA_PURGE, 4),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version/%/view'] = array(
$items['islandora/object/%islandora_object/datastream/%islandora_datastream/version/%/view'] = array(
@ -278,7 +291,7 @@ function islandora_menu() {
'page arguments' => array(2),
'page arguments' => array(2),
'type' => MENU_CALLBACK,
'type' => MENU_CALLBACK,
'access callback' => 'islandora_object_access',
'access callback' => 'islandora_object_access',
'access arguments' => array(FE DORA_VIEW_OBJECTS, 2),
'access arguments' => array(ISLAN DORA_VIEW_OBJECTS, 2),
'load arguments' => array(2),
'load arguments' => array(2),
);
);
$items[ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE] = array(
$items[ISLANDORA_CONTENT_MODELS_AUTOCOMPLETE] = array(
@ -391,27 +404,27 @@ function islandora_theme() {
*/
*/
function islandora_permission() {
function islandora_permission() {
return array(
return array(
FE DORA_VIEW_OBJECTS => array(
ISLAN DORA_VIEW_OBJECTS => array(
'title' => t('View repository objects'),
'title' => t('View repository objects'),
'description' => t('View objects in the repository. Note: Fedora XACML security policies may override this permission.'),
'description' => t('View objects in the repository. Note: Fedora XACML security policies may override this permission.'),
),
),
FE DORA_ADD_DS => array(
ISLAN DORA_ADD_DS => array(
'title' => t('Add datastreams to repository objects'),
'title' => t('Add datastreams to repository objects'),
'description' => t('Add datastreams to objects in the repository. Note: Fedora XACML security policies may override this position.'),
'description' => t('Add datastreams to objects in the repository. Note: Fedora XACML security policies may override this position.'),
),
),
FE DORA_METADATA_EDIT => array(
ISLAN DORA_METADATA_EDIT => array(
'title' => t('Edit metadata'),
'title' => t('Edit metadata'),
'description' => t('Edit metadata for objects in the repository.'),
'description' => t('Edit metadata for objects in the repository.'),
),
),
FE DORA_INGEST => array(
ISLAN DORA_INGEST => array(
'title' => t('Create new repository objects'),
'title' => t('Create new repository objects'),
'description' => t('Create new objects in the repository.'),
'description' => t('Create new objects in the repository.'),
),
),
FE DORA_PURGE => array(
ISLAN DORA_PURGE => array(
'title' => t('Permanently remove objects from the repository'),
'title' => t('Permanently remove objects from the repository'),
'description' => t('Permanently remove objects from the repository.'),
'description' => t('Permanently remove objects from the repository.'),
),
),
FE DORA_MANAGE_PROPERTIES => array(
ISLAN DORA_MANAGE_PROPERTIES => array(
'title' => t('Manage object properties'),
'title' => t('Manage object properties'),
'description' => t('Modify object labels, owner IDs, and states.'),
'description' => t('Modify object labels, owner IDs, and states.'),
),
),
@ -803,7 +816,7 @@ function islandora_view_object(AbstractObject $object) {
drupal_add_js(array(
drupal_add_js(array(
'islandora' => array(
'islandora' => array(
'print_link' => '/ islandora/object/' . $object->id . '/print')),
'print_link' => 'islandora/object/' . $object->id . '/print')),
array('type' => 'setting'));
array('type' => 'setting'));
drupal_add_js($path . '/js/add_print.js');
drupal_add_js($path . '/js/add_print.js');
@ -1440,7 +1453,7 @@ function islandora_islandora_object_access($op, $object, $user) {
/**
/**
* Hookable access callback for datastreams.
* Hookable access callback for datastreams.
*
*
* Requires the equivalent permissions on the object .
* Positive permissions on object access suggests on the datastream .
*/
*/
function islandora_datastream_access($op, $datastream, $user = NULL) {
function islandora_datastream_access($op, $datastream, $user = NULL) {
$cache = &drupal_static(__FUNCTION__);
$cache = &drupal_static(__FUNCTION__);
@ -1469,10 +1482,9 @@ function islandora_datastream_access($op, $datastream, $user = NULL) {
$user,
$user,
));
));
// Neither the object nor the datastream check returned FALSE, and one in
// The datastream check returned FALSE, and one in the object or datastream
// the object or datastream checks returned TRUE.
// checks returned TRUE.
$cache[$op][$datastream->parent->id][$datastream->id][$user->uid] = (
$cache[$op][$datastream->parent->id][$datastream->id][$user->uid] = (
!in_array(FALSE, $object_results, TRUE) &&
!in_array(FALSE, $datastream_results, TRUE) &&
!in_array(FALSE, $datastream_results, TRUE) &&
(in_array(TRUE, $object_results, TRUE) || in_array(TRUE, $datastream_results, TRUE))
(in_array(TRUE, $object_results, TRUE) || in_array(TRUE, $datastream_results, TRUE))
);
);