|
@@ -42,11 +42,13 @@ class TableAcl extends Core_AclBase {
|
|
|
public $_types = array();
|
|
public $_types = array();
|
|
|
public $_virtualFieldsIdList = array();
|
|
public $_virtualFieldsIdList = array();
|
|
|
public $_schemaLoaded = false;
|
|
public $_schemaLoaded = false;
|
|
|
|
|
+ public $_primaryKeyField = null;
|
|
|
|
|
+ public $_sourceNamespace = null;
|
|
|
|
|
|
|
|
public function __construct($zasobID) { $this->_zasobID = $zasobID; }
|
|
public function __construct($zasobID) { $this->_zasobID = $zasobID; }
|
|
|
- public function getNamespace() { return 'default_db/' . $this->getName(); }
|
|
|
|
|
- public function getRootNamespace() { return 'default_db/' . $this->getName(); }
|
|
|
|
|
- public function getSourceName() { return 'default_db'; }
|
|
|
|
|
|
|
+ public function getNamespace() { return $this->_sourceNamespace ? $this->_sourceNamespace . "/" . $this->getName() : 'default_db/' . $this->getName(); }
|
|
|
|
|
+ public function getRootNamespace() { return $this->getNamespace(); }
|
|
|
|
|
+ public function getSourceName() { return $this->_sourceNamespace ? $this->_sourceNamespace : 'default_db'; }
|
|
|
public function getName() { return $this->_name; }
|
|
public function getName() { return $this->_name; }
|
|
|
public function getRootTableName() {
|
|
public function getRootTableName() {
|
|
|
if (empty($this->_name)) return null;// throw new Exception("Table name not defined");
|
|
if (empty($this->_name)) return null;// throw new Exception("Table name not defined");
|
|
@@ -952,7 +954,7 @@ class TableAcl extends Core_AclBase {
|
|
|
if (empty($objectList)) throw new Exception("Acl [{$idTable}] not exists in SystemObject"); // TODO: update Storage object list?
|
|
if (empty($objectList)) throw new Exception("Acl [{$idTable}] not exists in SystemObject"); // TODO: update Storage object list?
|
|
|
|
|
|
|
|
$objItem = reset($objectList);
|
|
$objItem = reset($objectList);
|
|
|
- DBG::log($objItem, 'array', "DBG objItem({$idTable})");
|
|
|
|
|
|
|
+ // DBG::log($objItem, 'array', "DBG objItem({$idTable})");
|
|
|
switch ($objItem['_type']) {
|
|
switch ($objItem['_type']) {
|
|
|
// case 'TableAcl': // TODO: TEST - to replace TableAcl by AntAcl or use object with namespace + '/tableName'?
|
|
// case 'TableAcl': // TODO: TEST - to replace TableAcl by AntAcl or use object with namespace + '/tableName'?
|
|
|
case 'AntAcl': {
|
|
case 'AntAcl': {
|
|
@@ -1456,7 +1458,7 @@ class TableAcl extends Core_AclBase {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function fromArray($arr) {
|
|
public function fromArray($arr) {
|
|
|
- // DBG::log("fromArray(name='{$arr['name']}')");
|
|
|
|
|
|
|
+ // DBG::log($arr, 'array', "fromArray(name='{$arr['name']}')");
|
|
|
$this->_db = $arr['db'];
|
|
$this->_db = $arr['db'];
|
|
|
$this->_name = $arr['name'];
|
|
$this->_name = $arr['name'];
|
|
|
$this->_rootTableName = V::get('_rootTableName', null, $arr);
|
|
$this->_rootTableName = V::get('_rootTableName', null, $arr);
|
|
@@ -1805,16 +1807,22 @@ class TableAcl extends Core_AclBase {
|
|
|
$dsConfig['field_types'] = $this->getTypes();
|
|
$dsConfig['field_types'] = $this->getTypes();
|
|
|
$dsConfig['fields_virtual'] = $this->getVirtualFieldListByIdZasob();
|
|
$dsConfig['fields_virtual'] = $this->getVirtualFieldListByIdZasob();
|
|
|
$dsConfig['acl_fltr_allowed'] = !$this->hasSuperAccessPerms(); // filtr Access is visible only if user dont have supe access perms. If has then see all rows
|
|
$dsConfig['acl_fltr_allowed'] = !$this->hasSuperAccessPerms(); // filtr Access is visible only if user dont have supe access perms. If has then see all rows
|
|
|
|
|
+ // DBG::log($dsConfig, 'array', "DBG:DataSourceFactory::buildFromZasobInfo(\$dsConfig)");
|
|
|
return DataSourceFactory::buildFromZasobInfo($dsConfig);
|
|
return DataSourceFactory::buildFromZasobInfo($dsConfig);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getPrimaryKeyField() {
|
|
public function getPrimaryKeyField() {
|
|
|
|
|
+ if ($this->_primaryKeyField) return $this->_primaryKeyField;
|
|
|
if ($this->loadSchema()) {
|
|
if ($this->loadSchema()) {
|
|
|
$pkField = $this->_schemaClass->getPrimaryKeyField();
|
|
$pkField = $this->_schemaClass->getPrimaryKeyField();
|
|
|
- if ($pkField) return $pkField;
|
|
|
|
|
|
|
+ if ($pkField) {
|
|
|
|
|
+ $this->_primaryKeyField = $pkField;
|
|
|
|
|
+ return $this->_primaryKeyField;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
$ds = $this->getDataSource();
|
|
$ds = $this->getDataSource();
|
|
|
- return $ds->getPrimaryKeyField();
|
|
|
|
|
|
|
+ $this->_primaryKeyField = $ds->getPrimaryKeyField();
|
|
|
|
|
+ return $this->_primaryKeyField;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function isIntegerField($fldName) {
|
|
public function isIntegerField($fldName) {
|