Przeglądaj źródła

added p5:allow_read to DescribeFeatureTypeAdvanced

Piotr Labudda 9 lat temu
rodzic
commit
57f1a0c39b
1 zmienionych plików z 9 dodań i 16 usunięć
  1. 9 16
      SE/se-lib/Api/WfsServerBase.php

+ 9 - 16
SE/se-lib/Api/WfsServerBase.php

@@ -1449,7 +1449,7 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
 			// <xsd:element maxOccurs="1" minOccurs="0" name="{$fldName}" nillable="true" type="xsd:integer"/>
 			$pKeyField = $acl->getPrimaryKeyField();
 			$p5Attributes = ($simple)? array() : $acl->getAttributesFromZasoby();
-			foreach ($fldList as $fldName) {
+			foreach ($fldList as $idZasob => $fldName) {
 				$elNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:element');
 				$seqNode->appendChild($elNode);
 				$elNode->setAttribute('name', $fldName);
@@ -1494,22 +1494,15 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
 				$elNode->setAttribute('type', $fldType);
 
 				if (!$simple) {
-					$idZasob = (!empty($p5Attributes[$fldName]['id_zasob']))? (int)$p5Attributes[$fldName]['id_zasob'] : null;
-					if ($idZasob > 0) {
-						$elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:id_zasob", $idZasob);
-					}
-					if (!empty($p5Attributes[$fldName]['label'])) {
-						$elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:label", $p5Attributes[$fldName]['label']);
-					}
-					if (!empty($p5Attributes[$fldName]['description'])) {
-						$elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:description", $p5Attributes[$fldName]['description']);
-					}
-					if ($idZasob > 0 && $acl->hasFieldPerm($idZasob, 'W')) {
-						$elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:allow_write", "true");
-					}
-					if ($idZasob > 0 && $acl->hasFieldPerm($idZasob, 'C')) {
-						$elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:allow_create", "true");
+					$elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:id_zasob", $idZasob);
+					if (!empty($p5Attributes[$fldName])) {
+						$p5attrs = $p5Attributes[$fldName];
+						if (!empty($p5attrs['label'])) $elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:label", $p5attrs['label']);
+						if (!empty($p5attrs['description'])) $elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:description", $p5attrs['description']);
 					}
+					if ($acl->hasFieldPerm($idZasob, 'W')) $elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:allow_write", "true");
+					if ($acl->hasFieldPerm($idZasob, 'C')) $elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:allow_create", "true");
+					if (!$acl->hasFieldPerm($idZasob, 'R')) $elNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:allow_read", "false");
 				}
 			}