Skip to content

Commit

Permalink
Revert "ISLANDORA-1985 Add a permission to access inactive or deleted…
Browse files Browse the repository at this point in the history
… objects. (#677)" (#694)

This reverts commit 4f3aefd. It did not work, and
to make it work requires fixing an underlying issue of datastream permissions being
independent from object permissions.
  • Loading branch information
rosiel authored and DiegoPino committed Oct 30, 2017
1 parent 68cb674 commit 5038072
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 56 deletions.
6 changes: 0 additions & 6 deletions includes/admin.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,6 @@ function islandora_repository_admin(array $form, array &$form_state) {
'#description' => t('During the ingest workflow, make the OBJ file upload step mandatory.'),
'#default_value' => variable_get('islandora_require_obj_upload', TRUE),
),
'islandora_deny_inactive_and_deleted' => array(
'#type' => 'checkbox',
'#title' => t('Lock down inactive and deleted objects.'),
'#description' => t('Deny access to inactive or deleted objects using a separate permission than for active objects.'),
'#default_value' => variable_get('islandora_deny_inactive_and_deleted', FALSE),
),
),
'islandora_namespace' => array(
'#type' => 'fieldset',
Expand Down
36 changes: 0 additions & 36 deletions includes/object_properties.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* The drupal form definition.
*/
function islandora_object_properties_form(array $form, array &$form_state, AbstractObject $object) {
if (isset($form_state['islandora']['needs_confirmation'])) {
return islandora_object_properties_confirm_form($form_state);
}
$form_state['object'] = $object;
$temp = islandora_invoke_hook_list(ISLANDORA_UPDATE_RELATED_OBJECTS_PROPERTIES_HOOK, $object->models, array($object));
$related_objects_pids = array();
Expand Down Expand Up @@ -113,22 +110,6 @@ function islandora_object_properties_form(array $form, array &$form_state, Abstr
* The Drupal form state.
*/
function islandora_object_properties_form_submit(array $form, array &$form_state) {
if (isset($form_state['islandora']['needs_confirmation'])) {
$form_state['values'] = $form_state['islandora']['values'];
}
else {
// Confirm if user is about to lock themselves out of this object.
if (variable_get('islandora_deny_inactive_and_deleted', FALSE) && in_array($form_state['values']['object_state'], array('I', 'D'))) {
if ($form_state['object']->state == 'A') {
if (!user_access(ISLANDORA_ACCESS_INACTIVE_AND_DELETED_OBJECTS)) {
$form_state['islandora']['needs_confirmation'] = TRUE;
$form_state['islandora']['values'] = $form_state['values'];
$form_state['rebuild'] = TRUE;
return;
}
}
}
}
$object = $form_state['object'];
$owner = $form_state['values']['object_owner'];
$state = $form_state['values']['object_state'];
Expand Down Expand Up @@ -233,20 +214,3 @@ function islandora_update_object_properties($pid, $update_states, $state, $updat
function islandora_object_properties_regenerate_derivatives(array $form, array &$form_state) {
drupal_goto("islandora/object/{$form_state['object']}/regenerate");
}

/**
* Confirmation form for object properties admin form.
*
* @param array $form_state
* The Drupal form state.
*/
function islandora_object_properties_confirm_form(array &$form_state) {
$desc = t('You do not have permission to view Inactive or Deleted objects, so you will no longer be able to view or manage this object. Are you sure?');
$path = "islandora/object/{$form_state['object']->id}/manage/properties";
return confirm_form(array(),
t('Are you sure you want to set the object state?'),
$path,
$desc,
t('Continue'),
t('Cancel'));
}
17 changes: 3 additions & 14 deletions islandora.module
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ define('ISLANDORA_INGEST', 'ingest fedora objects');
define('ISLANDORA_PURGE', 'delete fedora objects and datastreams');
define('ISLANDORA_MANAGE_PROPERTIES', 'manage object properties');
define('ISLANDORA_VIEW_DATASTREAM_HISTORY', 'view old datastream versions');
define('ISLANDORA_ACCESS_INACTIVE_AND_DELETED_OBJECTS', 'access inactive and deleted objects');
define('ISLANDORA_MANAGE_DELETED_OBJECTS', 'manage deleted objects');
define('ISLANDORA_REVERT_DATASTREAM', 'revert to old datastream');
define('ISLANDORA_REGENERATE_DERIVATIVES', 'regenerate derivatives for an object');
Expand Down Expand Up @@ -579,7 +578,7 @@ function islandora_theme() {
* Implements hook_permission().
*/
function islandora_permission() {
$permissions = array(
return array(
ISLANDORA_VIEW_OBJECTS => array(
'title' => t('View repository objects'),
'description' => t('View objects in the repository. Note: Fedora XACML security policies may override this permission.'),
Expand Down Expand Up @@ -625,13 +624,6 @@ function islandora_permission() {
'description' => t('Add new datastream content as latest version.'),
),
);
if (variable_get('islandora_deny_inactive_and_deleted', FALSE)) {
$permissions[ISLANDORA_ACCESS_INACTIVE_AND_DELETED_OBJECTS] = array(
'title' => t('Access inactive and deleted objects'),
'description' => t('Access objects with a Fedora state of Inactive or Deleted.'),
);
}
return $permissions;
}

/**
Expand Down Expand Up @@ -1698,11 +1690,8 @@ function islandora_object_access($op, $object, $user = NULL) {
*/
function islandora_islandora_object_access($op, $object, $user) {
module_load_include('inc', 'islandora', 'includes/utilities');
$access = (islandora_namespace_accessible($object->id) && user_access($op, $user));
if (($object->state != 'A') && variable_get('islandora_deny_inactive_and_deleted', FALSE)) {
$access = ($access && user_access(ISLANDORA_ACCESS_INACTIVE_AND_DELETED_OBJECTS, $user));
}
return $access;

return islandora_namespace_accessible($object->id) && user_access($op, $user);
}

/**
Expand Down

0 comments on commit 5038072

Please sign in to comment.