Browse Source

fixed BUG in WFS Recurse - Missing xmlns for xlinks

Piotr Labudda 8 years ago
parent
commit
553f525d98
1 changed files with 9 additions and 2 deletions
  1. 9 2
      SE/se-lib/Api/Wfs/GetFeature.php

+ 9 - 2
SE/se-lib/Api/Wfs/GetFeature.php

@@ -23,7 +23,7 @@ class Api_Wfs_GetFeature {
 		if (empty($ogcPropertyList)) {
 			$ogcPropertyList = array_values($acl->getFieldListByIdZasob());
 			$ogcPropertyList = array_filter($ogcPropertyList, function ($fieldName) use ($acl) {
-				return $acl->canReadField($fieldName);
+				return $acl->canReadField($fieldName); // TODO: || $acl->canReadObjectField();
 			});
 		}
 
@@ -55,6 +55,13 @@ class Api_Wfs_GetFeature {
 			if (!$acl->canReadField($fieldName)) throw new Exception("Access Denied to read field '{$fieldName}' from '" . $acl->getNamespace() . "'");
 		}
 
+		foreach ($aclFields as $fieldName) {
+			if (false !== strpos($fieldName, ':')) {
+				$childNs = str_replace(['__x3A__', ':'], '/', $fieldName);
+				$schemaCache[$childNs] = SchemaFactory::loadDefaultObject('SystemObject')->getItem($childNs, [ 'propertyName' => '*,field' ]);
+			}
+		}
+
 		$contextFieldList = $aclFields;
 		foreach ($nestedFields as $childName => $nestedProps) {
 			$childNs = str_replace(['__x3A__', ':'], '/', $childName);
@@ -155,7 +162,7 @@ class Api_Wfs_GetFeature {
 					if (!array_key_exists($fieldNs, $schemaCache)) {
 						// maybe only xlinks - acl not needed
 						$firstItem = reset($item[$fldName]);
-						if (1 === count($firstItem) && !empty($firstItem['xlink'])) {
+						if (1 === count($firstItem) && !empty($firstItem['xlink'])) { // TODO: $schemaCache[$fieldNs] must exists for xlinks - xlmns is required
 							foreach ($item[$fldName] as $childItem) {
 								self::printXmlFeatureRecurse($xmlWriter, $childAcl = null, $childItem, $fldName, [], $showAdvancedAttrs, $schemaCache, $printedFidLog);
 							}