From acc142b8d93f39ae918dcc2b929d107a0d1370d8 Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Thu, 20 Jun 2013 09:23:15 -0300 Subject: [PATCH] Implement basic collection filter hook for namespaces. --- islandora.module | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/islandora.module b/islandora.module index 7e1936c3..ea4050f7 100644 --- a/islandora.module +++ b/islandora.module @@ -1319,3 +1319,17 @@ function islandora_datastream_access($op, $datastream, $user = NULL) { return $cache[$op][$datastream->parent->id][$datastream->id][$user->uid]; } + +/* + * Implements hook_islandora_basic_collection_get_filters(). + */ +function islandora_islandora_basic_collection_get_filters() { + $enforced = variable_get('islandora_namespace_restriction_enforced', FALSE); + if ($enforced) { + $namespace_array = islandora_get_allowed_namespaces(); + $namespace_sparql = implode('|', $namespace_array); + return format_string('regex(str(?object), "info:fedora/(!namespaces):")', array( + '!namespaces' => $namespace_sparql, + )); + } +}