Forráskód Böngészése

fixed web_link - only for defaut_db, added base class for Acl

Piotr Labudda 9 éve
szülő
commit
e4f546fe62

+ 5 - 2
SE/se-lib/Api/WfsServerBase.php

@@ -1474,8 +1474,11 @@ if($DBG){echo 'L.' . __LINE__ . ' $validateConvertedTransactionXsdString:';print
 			$rootNode->appendChild($cTypeNode);
 			$cTypeNode->setAttribute('name', $typeName);
 			if (!$simple) {
-				$idZasob = $acl->getID();
-				$cTypeNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:web_link", Request::getPathUri() . "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID={$idZasob}");
+				$sourceName = $acl->getSourceName();
+				if ('default_db' == $sourceName) {
+					$tblName = $acl->getName();
+					$cTypeNode->setAttributeNS($rootWfsNsUri, "{$rootWfsNs}:web_link", Request::getPathUri() . "index.php?_route=ViewTableAjax&typeName=p5_{$sourceName}:{$tblName}");
+				}
 			}
 
 			$cConNode = $dom->createElementNS('http://www.w3.org/2001/XMLSchema', 'xsd:complexContent');

+ 30 - 0
SE/se-lib/Core/AclBase.php

@@ -0,0 +1,30 @@
+<?php
+
+class Core_AclBase {
+
+  public function getSourceName() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getName() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getID() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }// TODO: Legacy
+  public function init($force = false) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isInitialized() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getRealFieldListByIdZasob($force = false) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getFieldIdByName($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isIntegerField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isDecimalField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isGeomField($fldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isDateField($fldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isDateTimeField($fldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isStringField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isTextField($fldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isBinaryField($fieldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isEnumerationField($fldName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getFieldType($colName) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function isAllowed($idZasob, $taskPerm, $record = null) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function hasFieldPerm($idZasob, $taskPerm) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getItems($params = array()) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function addItem($todoItem) { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getGeomFieldType() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getPrimaryKeyField() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+  public function getAttributesFromZasoby() { throw new HttpException("Acl function " . __FUNCTION__ . " Not implemented", 501); }
+
+}

+ 4 - 6
SE/se-lib/FileStorageAcl.php

@@ -1,14 +1,12 @@
 <?php
 
+Lib::loadClass('Core_AclBase');
 Lib::loadClass('FileStorage');
 
-class FileStorageAcl {
-
-  public function __construct() {
-
-  }
-
+class FileStorageAcl extends Core_AclBase {
 
+  public function __construct() {}
+  public function getSourceName() { return 'objects'; }
   public function init($force = false) {}
   public function isInitialized() { return true; }
   public function getName() { return 'File'; }

+ 11 - 32
SE/se-lib/TableAcl.php

@@ -1,5 +1,6 @@
 <?php
 
+Lib::loadClass('Core_AclBase');
 Lib::loadClass('SchemaException');
 
 /**
@@ -23,7 +24,7 @@ Lib::loadClass('SchemaException');
  *   )
  * );
  */
-class TableAcl {
+class TableAcl extends Core_AclBase {
 
 	private $_zasobID = '';
 	private $_db = '';
@@ -35,17 +36,15 @@ class TableAcl {
 	private $_virtualFieldsIdList = array();
 	private $_schemaLoaded = false;
 
-	public function __construct($zasobID) {
-		$this->_zasobID = $zasobID;
-	}
-
-	public function getID() {
-		return $this->_zasobID;
-	}
-
-	public function setName($name) {
-		$this->_name = $name;
-	}
+	public function __construct($zasobID) { $this->_zasobID = $zasobID; }
+	public function getSourceName() { return 'default_db'; }
+	public function getName() { return $this->_name; }
+	public function getID() { return $this->_zasobID; }
+	public function setName($name) { $this->_name = $name; }
+	public function setOpis($opis) { $this->_opis = $opis; }
+	public function getOpis() { return $this->_opis; }
+	public function setLabel($label) { $this->_label = $label; }
+	public function getLabel() { return $this->_label; }
 
 	public function setNameByTableId($tableID) {
 		//used for init without knowing table name
@@ -57,26 +56,6 @@ class TableAcl {
 		self::setName($res->DESC);
 	}
 
-	public function getName() {
-		return $this->_name;
-	}
-
-	public function setOpis($opis) {
-		$this->_opis = $opis;
-	}
-
-	public function getOpis() {
-		return $this->_opis;
-	}
-
-	public function setLabel($label) {
-		$this->_label = $label;
-	}
-
-	public function getLabel() {
-		return $this->_label;
-	}
-
 	public function getRawOpis() {
 		$opis = $this->_opis;
 		if (!$opis) return $this->getRawLabel(100);