From 1e2e183602f6430550b0edc912dd774a867d9b60 Mon Sep 17 00:00:00 2001 From: Nelson Hart Date: Wed, 3 Sep 2014 08:51:12 -0600 Subject: [PATCH] ignore cache when working with dsid checks --- fedora_repository.module | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fedora_repository.module b/fedora_repository.module index ab418325..cbed0909 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -1719,13 +1719,19 @@ function fedora_repository_check_perm($op, $pid = NULL, $as_user = NULL, $reset_ global $user; $as_user = $user; } - - // Populate the cache on a miss. - if (!isset($cache[$op][$pid][$as_user->uid]) || $dsid) { + if ($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)); + return (!in_array(FALSE, $results, TRUE) && in_array(TRUE, $results, TRUE)); } + else { + // Populate the cache on a miss. + if (!isset($cache[$op][$pid][$as_user->uid])) { + $results = module_invoke_all('fedora_repository_check_perm', $op, $pid, $as_user); + // Nothing returned FALSE, and something returned TRUE. + $cache[$op][$pid][$as_user->uid] = (!in_array(FALSE, $results, TRUE) && in_array(TRUE, $results, TRUE)); + } + } + return $cache[$op][$pid][$as_user->uid]; }