Browse Source

added path to admin page for admin users only on page denied error.

pull/105/head
Alan Stanley 14 years ago
parent
commit
38833546e3
  1. 32
      fedora_repository.module

32
fedora_repository.module

@ -105,7 +105,6 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label
drupal_set_message(t("This collection PID $collection_pid is not valid"), 'error'); drupal_set_message(t("This collection PID $collection_pid is not valid"), 'error');
return ' '; return ' ';
} }
} }
if ($collection_pid == NULL) { if ($collection_pid == NULL) {
@ -263,8 +262,7 @@ function fedora_repository_purge_object_form(&$form_state, $pid, $referrer) {
//$form['#redirect'] = $referrer; //$form['#redirect'] = $referrer;
return $form; return $form;
} } else {
else {
// ALSO do $form definition here. Your final submit handler (after user clicks Yes, I Confirm) will only see $form_state info defined here. Form you create here passed as param1 to confirm_form // ALSO do $form definition here. Your final submit handler (after user clicks Yes, I Confirm) will only see $form_state info defined here. Form you create here passed as param1 to confirm_form
return confirm_form($form, 'Confirm Purge Object', $referrer, 'Are you sure you want to delete this object? This action cannot be undone.', 'Delete', 'Cancel'); //Had better luck leaving off last param 'name' return confirm_form($form, 'Confirm Purge Object', $referrer, 'Are you sure you want to delete this object? This action cannot be undone.', 'Delete', 'Cancel'); //Had better luck leaving off last param 'name'
@ -409,8 +407,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) {
if (!isset($form_state['storage']['confirm'])) { if (!isset($form_state['storage']['confirm'])) {
$form_state['storage']['confirm'] = TRUE; // this will cause the form to be rebuilt, entering the confirm part of the form $form_state['storage']['confirm'] = TRUE; // this will cause the form to be rebuilt, entering the confirm part of the form
$form_state['rebuild'] = TRUE; // along with this $form_state['rebuild'] = TRUE; // along with this
} } else {
else {
// this is where you do your processing after they have pressed the confirm button // this is where you do your processing after they have pressed the confirm button
$params = array( $params = array(
"pid" => $pid, "pid" => $pid,
@ -435,8 +432,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) {
} }
if (!empty($form_state['values']['referrer'])) { if (!empty($form_state['values']['referrer'])) {
$form_state['redirect'] = $form_state['values']['referrer']; $form_state['redirect'] = $form_state['values']['referrer'];
} } else {
else {
$form_state['redirect'] = "fedora/repository/$collectionPid/"; $form_state['redirect'] = "fedora/repository/$collectionPid/";
} }
} }
@ -767,7 +763,13 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
return ' '; return ' ';
} }
if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied!"), 'error'); //drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error');
if (user_access('access administration pages')) {
drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'warning');
}
drupal_access_denied();
exit;
return ' '; return ' ';
} }
@ -844,8 +846,13 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'ObjectHelper');
global $user; global $user;
if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { if (!fedora_repository_access(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) {
drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied!"), 'error'); //drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied"), 'error');
drupal_access_denied();
if (user_access('access administration pages')) {
drupal_set_message(t("PIDs may be added to allowed namespaces, or all namespace restrictions removed !here", array('!here' => l('here', 'admin/settings/fedora_repository'))), 'error');
}
return ' '; return ' ';
} }
if ($pid == NULL) { if ($pid == NULL) {
@ -860,13 +867,11 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU
$item = new Fedora_Item($pid); $item = new Fedora_Item($pid);
if ($item !== false) if ($item !== false) {
{
echo $item->get_dissemination($servicePid, $serviceMethod); echo $item->get_dissemination($servicePid, $serviceMethod);
} }
exit(); exit();
} }
//Search Stuff ******************************************************************** //Search Stuff ********************************************************************
@ -989,8 +994,7 @@ function fedora_repository_search_page($resultData) {
$xsl = new DomDocument(); $xsl = new DomDocument();
if ($isRestricted) { if ($isRestricted) {
$xsl->load($path . '/xsl/results.xsl'); $xsl->load($path . '/xsl/results.xsl');
} } else {
else{
$xsl->load($path . '/xsl/unfilteredresults.xsl'); $xsl->load($path . '/xsl/unfilteredresults.xsl');
} }

Loading…
Cancel
Save