Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISLANDORA-1042 -- DESTROY ALL DEPRECATED CODE! #545

Merged
merged 9 commits into from
Feb 5, 2015
37 changes: 3 additions & 34 deletions includes/ingest.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,22 @@ function islandora_ingest_form(array $form, array &$form_state, array $configura
*/
function islandora_ingest_form_init_form_state_storage(array &$form_state, array $configuration) {
if (empty($form_state['islandora'])) {
$objects = isset($configuration['objects']) ? $configuration['objects'] : array();
if (empty($objects)) {
$objects[] = islandora_ingest_form_prepare_new_object($configuration);
}
$configuration['models'] = isset($configuration['models']) ? $configuration['models'] : array();
// Make sure the models actually exist.
foreach ($configuration['models'] as $key => $model) {
if (!islandora_object_load($model)) {
unset($configuration['models'][$key]);
}
}
// No need to persist the 'objects' within the configuration.
unset($configuration['objects']);
// Required for step hooks.
$form_state['islandora'] = array(
'step_id' => NULL,
'objects' => $objects,
'objects' => $configuration['objects'],
'shared_storage' => $configuration,
'step_storage' => array(),
);
// No need to persist the 'objects' within the configuration.
unset($configuration['objects']);
// Must be called after $form_state['islandora'] is initialized, otherwise,
// the values in 'islandora' would not be availible to the step hooks.
$form_state['islandora']['step_id'] = islandora_ingest_form_get_first_step_id($form_state);
Expand Down Expand Up @@ -136,33 +132,6 @@ function islandora_ingest_form_get_last_step_id(array &$form_state) {
return array_pop($keys);
}

/**
* Prepares a new object based on the given configuration.
*
* @param array $configuration
* The list of key/value pairs of configuration.
*
* @return NewFedoraObject
* The new object.
*/
function islandora_ingest_form_prepare_new_object(array $configuration) {
module_load_include('inc', 'islandora', 'includes/utilities');
if (empty($configuration['object'])) {
$message = islandora_deprecated('7.x-1.2', t('Please use "objects" as the default ingest form configuration property.'));
trigger_error(filter_xss($message), E_USER_DEPRECATED);
// ID is more specific than namespace so it will take precedence.
$id = isset($configuration['namespace']) ? $configuration['namespace'] : 'islandora';
$id = isset($configuration['id']) ? $configuration['id'] : $id;
$label = isset($configuration['label']) ? $configuration['label'] : 'New Object';
$relationship_map = function($o) {
return array('relationship' => 'isMemberOfCollection', 'pid' => $o);
};
$relationships = empty($configuration['collections']) ? array() : array_map($relationship_map, $configuration['collections']);
return islandora_prepare_new_object($id, $label, array(), array(), $relationships);
}
return $configuration['object'];
}

/**
* Gets the given/current step.
*
Expand Down
47 changes: 0 additions & 47 deletions includes/utilities.inc
Original file line number Diff line number Diff line change
Expand Up @@ -661,53 +661,6 @@ function islandora_system_settings_form_default_value($name, $default_value, arr
return isset($form_state['values'][$name]) ? $form_state['values'][$name] : variable_get($name, $default_value);
}

/**
* Checks that the given/current account has all the given permissions.
*
* @param array $perms
* The permissions to check.
* @param mixed $account
* (optional) The account to check, if not given use currently logged in user.
*
* @return bool
* TRUE if the account has all the given permissions, FALSE otherwise.
*/
function islandora_user_access_all(array $perms, $account = NULL) {
$message = islandora_deprecated('7.x-1.2', 'Roll your own code or use islandora_user_access().');
trigger_error(filter_xss($message), E_USER_DEPRECATED);

foreach ($perms as $perm) {
if (!user_access($perm, $account)) {
return FALSE;
}
}
return TRUE;
}

/**
* Checks that the given/current account has at one of the given permissions.
*
* @param array $perms
* The permissions to check.
* @param mixed $account
* (optional) The account to check, if not given use currently logged in user.
*
* @return bool
* TRUE if the account has at least one of the given permissions, FALSE
* otherwise.
*/
function islandora_user_access_any(array $perms, $account = NULL) {
$message = islandora_deprecated('7.x-1.2', 'Roll your own code or use islandora_user_access().');
trigger_error(filter_xss($message), E_USER_DEPRECATED);

foreach ($perms as $perm) {
if (user_access($perm, $account)) {
return TRUE;
}
}
return FALSE;
}

/**
* Gets the list of allowed namespaces as defined by 'islandora_pids_allowed'.
*
Expand Down
28 changes: 0 additions & 28 deletions islandora.module
Original file line number Diff line number Diff line change
Expand Up @@ -840,34 +840,6 @@ function islandora_object_access_callback($perm, $object = NULL) {
return islandora_object_access($perm, $object);
}

/**
* Checks whether the user can access the given object and datastream.
*
* Checks for object existance, accessiblitly, namespace permissions,
* and user permissions
*
* @param string $perm
* The user permission to test for.
* @param AbstractObject $object
* The object to test, if NULL given the object doesn't exist or is
* inaccessible.
* @param AbstractDatastream $datastream
* The datastream to test, if NULL given the datastream doesn't exist
* or is inaccessible.
* @param StdObject $account
* The account to test permissions as or NULL for current user.
*
* @return bool
* TRUE if the user is allowed to access this object, FALSE otherwise.
*/
function islandora_object_datastream_access_callback($perm, $object = NULL, $datastream = NULL, $account = NULL) {
module_load_include('inc', 'islandora', 'includes/utilities');
$message = islandora_deprecated('7.x-1.2', 'Use islandora_datastream_access().');
trigger_error(filter_xss($message), E_USER_DEPRECATED);

return islandora_datastream_access($perm, $datastream, $account);
}

/**
* Checks whether the user can access the given object and datastream.
*
Expand Down