parentAcl = User::getAcl()->getObjectAcl('default_db', 'IN7_DZIENNIK_KORESP'); // DBG::_(true, true, "parentAcl", $this->parentAcl, __CLASS__, __FUNCTION__, __LINE__); } public function getNamespace() { return 'default_objects/' . $this->getName(); } public function getSourceName() { return 'default_objects'; } public function init($force = false) {} public function isInitialized() { return true; } public function getName() { return 'Korespondencja'; } public function getRootTableName() { return 'IN7_DZIENNIK_KORESP'; } public function getFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); } public function getVisibleFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); } public function getVirtualFieldListByIdZasob() { return array(); } public function getRealFieldListByIdZasob($force = false) { $cols = $this->parentAcl->getRealFieldListByIdZasob(); $cols[100000] = 'File'; return $cols; } public function getFieldIdByName($fieldName) { $fields = $this->getRealFieldListByIdZasob(); if (empty($fieldName)) return null; foreach ($fields as $idField => $vFieldName) { if ($vFieldName == $fieldName) return $idField; } return null; } public function getFieldType($colName) { return null; } public function isAllowed($idZasob, $taskPerm, $record = null) { if ($this->parentAcl->hasFieldById($idZasob)) return $this->parentAcl->isAllowed($idZasob, $taskPerm, $record); $fields = $this->getRealFieldListByIdZasob(); if (array_key_exists($idZasob, $fields)) { if ('File' == $fields[$idZasob]) { foreach ($fields as $idFld => $name) { if ($idFld == $idZasob) continue; if ($this->parentAcl->isAllowed($idFld, $taskPerm, $record)) return true; } } } return false; } public function hasFieldPerm($idZasob, $taskPerm) { if ($this->parentAcl->hasFieldById($idZasob)) return $this->parentAcl->hasFieldPerm($idZasob, $taskPerm); $fields = $this->getRealFieldListByIdZasob(); if (array_key_exists($idZasob, $fields)) { if ('File' == $fields[$idZasob]) { foreach ($fields as $idFld => $name) { if ($idFld == $idZasob) continue; if ($this->parentAcl->hasFieldPerm($idFld, $taskPerm)) return true; } } } return false; } // TODO: replace legacy functions: isAllowed, hasFieldPerm, getFieldIdByName public function canCreateField($fieldName) { if ('File' == $fieldName) return true; return $this->parentAcl->canCreateField($fieldName); } public function canReadField($fieldName) { if ('File' == $fieldName) return true; return $this->parentAcl->canReadField($fieldName); } public function canReadObjectField($fieldName, $record) { if ('File' == $fieldName) return true; return $this->parentAcl->canReadObjectField($fieldName, $record); } public function canWriteField($fieldName) { if ('File' == $fieldName) return true; return $this->parentAcl->canWriteField($fieldName); } public function canWriteObjectField($fieldName, $record) { if ('File' == $fieldName) return true; return $this->parentAcl->canWriteObjectField($fieldName, $record); } public function getItems($params = array()) { $DBG = V::get('DBG_DS', 0, $_GET, 'int'); if($DBG>2){echo 'C.'.get_class($this).' L.' . __LINE__ . " getItems \$params:";print_r($params);echo "\n";} $items = array(); $rawItems = $this->parentAcl->getItems($params); foreach ($rawItems as $pk => $item) $items[$pk] = (array)$item; if($DBG>2){echo 'C.'.get_class($this).' L.' . __LINE__ . " getItems \$items:";print_r($items);echo "\n";} if (empty($items)) return $items; $this->itemsFetchRefs($items); if($DBG>2){echo 'C.'.get_class($this).' L.' . __LINE__ . " getItems after itemsFetchRefs \$items:";print_r($items);echo "\n";} return $items; } public function addItem($itemTodo) { return $this->parentAcl->addItem($itemTodo); } public function updateItem($itemPatch) { return $this->parentAcl->updateItem($itemPatch); } public function getGeomFieldType($fieldName) { return null; } public function getPrimaryKeyField() { return 'ID'; } public function getAttributesFromZasoby() { $attributes = array();// fldName => [ 'id_zasob' => int, 'label' => str, 'description' => str ] // 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"); return $attributes; } public function isEnumerationField($fieldName) { return false; } public function getXsdFieldType($fieldName) { if ('File' == $fieldName) return 'ref:default_objects:File'; return $this->parentAcl->getXsdFieldType($fieldName); } public function isGeomField($fldName) { return $this->parentAcl->isGeomField($fldName); } }