diff --git a/CollectionClass.inc b/CollectionClass.inc index bee0c495..6c5fd8f5 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -519,7 +519,8 @@ class CollectionClass { $show_batch_tab = FALSE; $policy = CollectionPolicy::loadFromCollection($this->pid, TRUE); - if ($policy) { + + if(!empty($policy)){ $content_models = $policy->getContentModels(); } if (count($content_models) == 1 && $content_models[0]->pid == "islandora:collectionCModel") { diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 9567fd70..f182464b 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -935,18 +935,22 @@ class ObjectHelper { or $parentObject) and $parentObject ) minus $content - order by $title'; + order by $title desc'; $query_string = htmlentities(urlencode($query_string)); $url = variable_get('fedora_repository_url', 'http://localhost:8080/fedora/risearch'); $url .= "?type=tuples&flush=TRUE&format=CSV&limit=1&offset=0&lang=itql&stream=on&query=" . $query_string; - + $result = preg_split('/[\r\n]+/', do_curl($url)); array_shift($result); // throw away first line $matches = str_getcsv(join("\n", $result)); - if ($matches !== FALSE) { + if (count($matches) >= 2) { $parent = preg_replace('/^info:fedora\//', '', $matches[0]); + if (0 == strlen($matches[1])) { + $matches[1] = "Unlabeled Object"; + } + $breadcrumbs[] = l($matches[1], 'fedora/repository/' . $pid); if ($parent == variable_get('fedora_repository_pid', 'islandora:root')) { $breadcrumbs[] = l(t('Digital repository'), 'fedora/repository'); @@ -956,6 +960,10 @@ class ObjectHelper { $this->getBreadcrumbs($parent, $breadcrumbs, $level - 1); } } + + else { + $breadcrumbs[] = l("Path Calculation Error", 'fedora/repository/' . $pid); + } } } diff --git a/SecurityClass.inc b/SecurityClass.inc index 1e2b1835..67bc9c43 100644 --- a/SecurityClass.inc +++ b/SecurityClass.inc @@ -34,7 +34,6 @@ class SecurityClass { $objectHelper = new ObjectHelper(); // get the childsecurity policy from the collection. $policyStream = $objectHelper->getStream($collection_pid, SECURITYCLASS :: $SECURITY_CLASS_SECURITY_STREAM, FALSE); - if ($policyStream == NULL) { // no child policy stream so collection is wide open to anyone to ingest, that has the permission ingest in Drupal. // maybe we should return FALSE here?? would be more secure. @@ -79,34 +78,19 @@ class SecurityClass { } $xml->registerXPathNamespace('default', 'urn:oasis:names:tc:xacml:1.0:policy'); - $conditions = $xml->xpath("//default:Condition"); - - foreach ($conditions as $condition) { - $designator = $condition->Apply->SubjectAttributeDesignator; - if (empty($designator)) {//$disignator may be wrapped by an or - $designator = $condition->Apply->Apply->SubjectAttributeDesignator; - } - $attributeId = strip_tags($designator['AttributeId']); + $roles = $xml->xpath('//default:SubjectAttributeDesignator[@AttributeId="fedoraRole"]/../default:Apply/default:AttributeValue'); + $users = $xml->xpath('//default:SubjectAttributeDesignator[@AttributeId="urn:fedora:names:fedora:2.1:subject:loginId"]/../default:Apply/default:AttributeValue'); - if ($attributeId == "fedoraRole") { - foreach ($condition->Apply->Apply->AttributeValue as $attributeValue) { - $allowedRoles[] = strip_tags($attributeValue->asXML()); - } - foreach ($condition->Apply->Apply->Apply->AttributeValue as $attributeValue) { - $allowedRoles[] = strip_tags($attributeValue->asXML()); - } - } - if ($attributeId == "urn:fedora:names:fedora:2.1:subject:loginId") { - foreach ($condition->Apply->Apply->AttributeValue as $attributeValue) { - $allowedUsers[] = strip_tags($attributeValue->asXML()); - } - foreach ($condition->Apply->Apply->Apply->AttributeValue as $attributeValue) { - $allowedUsers[] = strip_tags($attributeValue->asXML()); - } - } + foreach($roles as $role) { + $allowedRoles[] = (string)$role; } + foreach($users as $user) { + $allowedUsers[] = (string)$user; + } + $usersAndRoles['users'] = $allowedUsers; $usersAndRoles['roles'] = $allowedRoles; + return $usersAndRoles; } diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 54a9158b..a79749a7 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -43,7 +43,7 @@ class Fedora_Item { } $raw_objprofile = $this->soap_call('getObjectProfile', array('pid' => $this->pid, 'asOfDateTime' => "")); - + if (!empty($raw_objprofile)) { $this->objectProfile = $raw_objprofile->objectProfile; $this->datastreams = $this->get_datastreams_list_as_array(); @@ -297,18 +297,17 @@ class Fedora_Item { $i++; $url = variable_get('fedora_base_url', 'http://localhost:8080/fedora'); if ($cursor == 0) { - $url .= "/objects?query=$field~$pattern&pid=TRUE&title=TRUE&resultFormat=xml&maxResults=$max_results"; + $url .= "/objects?query=$field~$pattern&pid=true&title=TRUE&resultFormat=xml&maxResults=$max_results"; } else { - $url .= "/objects?pid=TRUE&title=TRUEsessionToken=$session_token&resultFormat=xml&maxResults=$max_results"; + $url .= "/objects?pid=true&title=true&sessionToken=$session_token&resultFormat=xml&maxResults=$max_results"; } if (count($resultFields) > 0) { - $url .= '&' . join('=TRUE&', $resultFields) . '=TRUE'; + $url .= '&' . join('=true&', $resultFields) . '=true'; } $resultxml = do_curl($url); - libxml_use_internal_errors(TRUE); $resultelements = simplexml_load_string($resultxml); if ($resultelements === FALSE) { diff --git a/fedora_repository.info b/fedora_repository.info index 99cb3d6f..45564e20 100644 --- a/fedora_repository.info +++ b/fedora_repository.info @@ -5,5 +5,5 @@ dependencies[] = tabs dependencies[] = islandora_content_model_forms description = Shows a list of items in a fedora collection. package = Islandora -version = 11.2.0 +version = 11.3beta1 core = 6.x diff --git a/plugins/fedora_imageapi.info b/plugins/fedora_imageapi.info index af50a614..ea14fb07 100644 --- a/plugins/fedora_imageapi.info +++ b/plugins/fedora_imageapi.info @@ -3,5 +3,5 @@ description = Adds image manipulation support through a REST interface package = Islandora Dependencies dependencies[] = fedora_repository dependencies[] = imageapi -version = 11.2.0 +version = 11.3beta1 core = 6.x