|
|
@@ -6,9 +6,9 @@ Lib::loadClass('Core_AclHelper');
|
|
|
class Api_Wfs_GetFeature {
|
|
|
|
|
|
public static function convertOgcPropertyListToFeatureQueryCols(&$schemaCache, $ogcPropertyList, $acl) {
|
|
|
- return self::convertOgcPropsRecurse($schemaCache, $ogcPropertyList, $acl);
|
|
|
+ return self::convertOgcPropsRecurse($schemaCache, $ogcPropertyList, $acl, $dbgLoopNr = 0, $dbgXpath = $acl->getNamespace());
|
|
|
}
|
|
|
- public static function convertOgcPropsRecurse(&$schemaCache, $ogcPropertyList, $aclOrSchema, $dbgLoopNr = 0) {
|
|
|
+ public static function convertOgcPropsRecurse(&$schemaCache, $ogcPropertyList, $aclOrSchema, $dbgLoopNr = 0, $dbgXpath = '') {
|
|
|
if ($dbgLoopNr > 10) {
|
|
|
DBG::log($ogcPropertyList, 'array', 'convertOgcPropsRecurse: LOOP LIMIT 10! - return []');
|
|
|
return [];
|
|
|
@@ -39,10 +39,15 @@ class Api_Wfs_GetFeature {
|
|
|
[]
|
|
|
);
|
|
|
if (!empty($nestedFields)) {
|
|
|
+ if (array_key_exists('*', $nestedFields)) { // add missing local fields if xpath like '*/...'
|
|
|
+ $aclFields[] = '*';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!empty($nestedFields)) { // add nested part to refs if xpath like '*/...'
|
|
|
if (array_key_exists('*', $nestedFields)) {
|
|
|
$nestedParts = $nestedFields['*'];
|
|
|
unset($nestedFields['*']);
|
|
|
- DBG::log($nestedParts, 'array', "convertOgcPropsRecurse: TODO: '*' in \$nestedFields - \$nestedParts");
|
|
|
+ DBG::log($nestedParts, 'array', "convertOgcPropsRecurse: TODO: '*' in \$nestedFields - \$nestedParts ns({$dbgXpath})");
|
|
|
$canReadRefs = array_values($acl->getFieldListByIdZasob());
|
|
|
$canReadRefs = array_filter($canReadRefs, function ($fieldName) use ($acl) {
|
|
|
return (false !== strpos($fieldName, ":") && $acl->canReadField($fieldName));
|
|
|
@@ -65,7 +70,7 @@ class Api_Wfs_GetFeature {
|
|
|
});
|
|
|
if ($allAclFields) $aclFields = array_unique(array_merge($aclFields, $allAclFields));
|
|
|
}
|
|
|
- DBG::log([$aclFields, $nestedFields], 'array', 'convertOgcPropsRecurse: splited to acl fields and nested fields');
|
|
|
+ DBG::log([$aclFields, $nestedFields], 'array', "convertOgcPropsRecurse: splited to acl fields and nested fields ns({$dbgXpath})");
|
|
|
|
|
|
foreach ($aclFields as $fieldName) {
|
|
|
if (!$acl->canReadField($fieldName)) throw new Exception("Access Denied to read field '{$fieldName}' from '" . $acl->getNamespace() . "'");
|
|
|
@@ -84,14 +89,14 @@ class Api_Wfs_GetFeature {
|
|
|
if (!array_key_exists($childNs, $schemaCache)) {
|
|
|
$schemaCache[$childNs] = SchemaFactory::loadDefaultObject('SystemObject')->getItem($childNs, [ 'propertyName' => '*,field' ]);
|
|
|
}
|
|
|
- $contextFieldList = array_merge(
|
|
|
- $contextFieldList,
|
|
|
- array_map(function ($childCtxFld) use ($childName) {
|
|
|
- return "{$childName}/{$childCtxFld}";
|
|
|
- }, self::convertOgcPropsRecurse($schemaCache, $nestedProps, $schemaCache[$childNs], $dbgLoopNr + 1))
|
|
|
- );
|
|
|
+ $childCtxFields = array_map(function ($childCtxFld) use ($childName) {
|
|
|
+ return "{$childName}/{$childCtxFld}";
|
|
|
+ }, self::convertOgcPropsRecurse($schemaCache, $nestedProps, $schemaCache[$childNs], $dbgLoopNr + 1, "{$dbgXpath}/{$childName}"));
|
|
|
+ DBG::log([ $contextFieldList, $childCtxFields ], 'array', "convertOgcPropsRecurse: array merge ns({$dbgXpath})");
|
|
|
+ $contextFieldList = array_merge( $contextFieldList, $childCtxFields );
|
|
|
+ DBG::log($contextFieldList, 'array', "convertOgcPropsRecurse: array merged ns({$dbgXpath})");
|
|
|
}
|
|
|
- DBG::log($contextFieldList, 'array', 'convertOgcPropsRecurse: return $contextFieldList');
|
|
|
+ DBG::log($contextFieldList, 'array', "convertOgcPropsRecurse: return \$contextFieldList ns({$dbgXpath})");
|
|
|
return $contextFieldList;
|
|
|
}
|
|
|
|