Browse Source

code review changes

pull/544/head
Nelson Hart 10 years ago
parent
commit
9e9e7808f9
  1. 6
      ObjectHelper.inc
  2. 8
      fedora_repository.module

6
ObjectHelper.inc

@ -93,7 +93,7 @@ class ObjectHelper {
return ' ';
}
if (!fedora_repository_check_perm(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user, TRUE, $dsID)) {
if (!fedora_repository_check_perm(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user, FALSE, $dsID)) {
drupal_set_message(t("You do not have access Fedora objects within the attempted namespace."), 'error');
drupal_access_denied();
return ' ';
@ -298,7 +298,7 @@ class ObjectHelper {
drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error');
return '';
}
if (!fedora_repository_check_perm(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user, TRUE, $dsID)) {
if (!fedora_repository_check_perm(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user, FALSE, $dsID)) {
drupal_set_message(t('You do not have the appropriate permissions'), 'error');
return;
}
@ -333,7 +333,7 @@ class ObjectHelper {
drupal_set_message(t('You must specify an object pid and datastream ID.'), 'error');
return '';
}
if (!fedora_repository_check_perm(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user, TRUE, $dsID)) {
if (!fedora_repository_check_perm(ObjectHelper :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user, FALSE, $dsID)) {
drupal_set_message(t('You do not have the appropriate permissions'), 'error');
return;
}

8
fedora_repository.module

@ -962,7 +962,7 @@ function makeObject($pid, $dsID) {
return ' ';
}
global $user, $conf;
if (!fedora_repository_check_perm(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user, TRUE, $dsID)) {
if (!fedora_repository_check_perm(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user, FALSE, $dsID)) {
drupal_access_denied();
return;
drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace."), 'error');
@ -1109,7 +1109,7 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
drupal_set_message(t("Invalid dsID!"), 'error');
return ' ';
}
if (!fedora_repository_check_perm(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user, TRUE, $dsId)) {
if (!fedora_repository_check_perm(OBJECTHELPER::$OBJECT_HELPER_VIEW_FEDORA, $pid, $user, FALSE, $dsId)) {
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');
}
@ -1698,6 +1698,8 @@ function fedora_repository_access() {
* An account to check the permission on, or NULL to use the current user.
* @param boolean $reset_cache
* A boolean to reset the static cache, if required in long-running processes.
* @param string|null $dsid
* A dsid to check, or NULL to use object level check.
*
* @return boolean
* A boolean indicating if the operation should be permitted (TRUE) or denied
@ -1719,7 +1721,7 @@ function fedora_repository_check_perm($op, $pid = NULL, $as_user = NULL, $reset_
}
// Populate the cache on a miss.
if (!isset($cache[$op][$pid][$as_user->uid])) {
if (!isset($cache[$op][$pid][$as_user->uid]) || $dsid) {
$results = module_invoke_all('fedora_repository_check_perm', $op, $pid, $as_user, $dsid);
// Nothing returned FALSE, and something returned TRUE.
$cache[$op][$pid][$as_user->uid] = (!in_array(FALSE, $results, TRUE) && in_array(TRUE, $results, TRUE));

Loading…
Cancel
Save