AccessOwnerStorageAcl.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. Lib::loadClass('Core_AclBase');
  3. class Schema_AccessOwnerStorageAcl extends Core_AclBase {
  4. public function getSourceName() { return 'objects'; }
  5. public function init($force = false) {}
  6. public function isInitialized() { return true; }
  7. public function getName() { return 'AccessOwner'; }
  8. public function getRootTableName() { return 'ADMIN_USERS'; }// TODO: turn off - use getName for generating ref's
  9. public function getFieldListByIdZasob() { return $this->getRealFieldListByIdZasob(); }
  10. public function getVirtualFieldListByIdZasob() { return array(); }
  11. public function getRealFieldListByIdZasob($force = false) {
  12. $cols[100000] = 'id';// ADMIN_USERS.ID
  13. $cols[100001] = 'login';// ADMIN_USERS.ADM_ACCOUNT
  14. $cols[100002] = 'name';// ADMIN_USERS.ADM_NAME
  15. return $cols;
  16. }
  17. public function getFields() { return array_values($this->getRealFieldListByIdZasob()); }
  18. public function getFieldType($fieldName) { return null; }
  19. // TODO: replace legacy functions: isAllowed, hasFieldPerm, getFieldIdByName
  20. public function canCreateField($fieldName) { return false; }
  21. public function canReadField($fieldName) { return true; }
  22. public function canReadObjectField($fieldName, $record) {return true; }
  23. public function canWriteField($fieldName) { return false; }
  24. public function canWriteObjectField($fieldName, $record) { return false; }
  25. public function getItems($params = array()) {
  26. $DBG = V::get('DBG_DS', 0, $_GET, 'int');
  27. if($DBG>2){echo 'C.'.get_class($this).' L.' . __LINE__ . " getItems \$params:";print_r($params);echo "\n";}
  28. $items = DB::getPDO()->fetchAllByKey("
  29. select u.ID as id, u.ADM_ACCOUNT as login, u.ADM_NAME as name
  30. from ADMIN_USERS u
  31. where u.A_STATUS = 'NORMAL'
  32. and u.ADM_TECH_WORKER != 'NO'
  33. ", $key = 'id');
  34. if($DBG>2){echo 'C.'.get_class($this).' L.' . __LINE__ . " getItems \$items:";print_r($items);echo "\n";}
  35. return $items;
  36. }
  37. public function addItem($itemTodo) { throw new Exception("Insert not allowed"); }
  38. public function updateItem($itemPatch) { throw new Exception("Update not allowed"); }
  39. public function getGeomFieldType($fieldName) { return null; }
  40. public function getPrimaryKeyField() { return 'id'; }
  41. public function getID() { return 0; }
  42. public function getAttributesFromZasoby() { return array(); }
  43. public function isEnumerationField($fieldName) { return false; }
  44. public function getEnumerations($fieldName) { return null; }
  45. public function getXsdFieldType($fieldName) {
  46. if ('id' == $fieldName) return 'xsd:string';
  47. if ('login' == $fieldName) return 'xsd:string';
  48. if ('name' == $fieldName) return 'xsd:string';
  49. }
  50. public function isGeomField($fldName) { return false; }
  51. }