From 33b3b4453f4134d3c701225bdeff85b880656226 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Mon, 13 Feb 2012 16:15:49 -0400 Subject: [PATCH 1/2] added permission filtering to get_collections_as_option_array() --- api/fedora_utils.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/api/fedora_utils.inc b/api/fedora_utils.inc index 89545191..c2665fc7 100644 --- a/api/fedora_utils.inc +++ b/api/fedora_utils.inc @@ -236,6 +236,8 @@ function fix_dsid($dsid) { function get_collections_as_option_array() { module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); $restricted = variable_get('fedora_namespace_restriction_enforced', TRUE); + $allowed_string = variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora:'); + $namespaces = explode(':', $allowed_string); $query = 'select $object $title from <#ri> where ($object $title and $object @@ -247,13 +249,22 @@ function get_collections_as_option_array() { $list = explode("\n", $content); array_shift($list); $list = preg_replace('/info:fedora\//', '', $list); + foreach ($namespaces as $namespace) { + $trimmed_names[] = trim($namespace); + } $options = array(); foreach ($list as $item) { //removes blanks if ($item) { $parts = explode(',', $item); - $options[$parts[0]] = $parts[1]; + $namespace = explode(':', $parts[0]); + $namespace = trim($namespace[0]); + $bool = in_array($namespace, $trimmed_names); + if (!$restricted || in_array($namespace, $trimmed_names)) { + $options[$parts[0]] = $parts[1]; + } } } + unset($options['islandora:ContentModelCollection']); return $options; } From 711b0082f3837cc3b1ce765a33bfef1a2fd58164 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Mon, 13 Feb 2012 16:20:26 -0400 Subject: [PATCH 2/2] getRelatedItems raised default limit to 10000 --- CollectionClass.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CollectionClass.inc b/CollectionClass.inc index 6c5fd8f5..ce3aafff 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -68,7 +68,7 @@ class CollectionClass { module_load_include('inc', 'fedora_repository', 'ObjectHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); if (!isset($limit)) { - $limit = 1000; + $limit = 10000; } if (!isset($offset)) { $offset = 0;