| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- class StorageAclBase {
- static function buildInstance($idZasob, $conf = []) {
- static $_cache;
- if (!$_cache) $_cache = array();
- if (array_key_exists($idZasob, $_cache)) {
- return $_cache[$idZasob];
- }
- if (empty($conf)) throw new Exception("Brak danych konfiguracyjnych do obiektu StorageAcl nr {$idZasob}");
- DBG::log($conf, 'array', 'AntAclBase::buildInstance $conf');
- if (empty($conf['name'])) throw new Exception("Błędne dane konfiguracyjne do obiektu StorageAcl nr {$idZasob}: brak nazwy");
- $className = "Schema_{$conf['name']}StorageAcl";
- Lib::loadClass($className);
- $acl = new $className($idZasob);
- $acl->_zasobID = (int)$idZasob;
- $acl->_name = $conf['name'];
- $acl->_rootTableName = $conf['_rootTableName'];
- $acl->_db = $conf['idDatabase'];
- $acl->_namespace = $conf['namespace'];
- $acl->_rootNamespace = str_replace('__x3A__', '/', $conf['nsPrefix']);
- $acl->_fields = $conf['field']; // TODO: lazyLoading - use getFields() in all functions - TODO: use ACL::getObjectFields
- $acl->_primaryKey = (!empty($conf['primaryKey'])) ? $conf['primaryKey'] : 'ID'; // $conf['primaryKey'];
- $acl->_hasWriteGroupField = $conf['hasWriteGroupField'];
- $acl->_hasReadGroupField = $conf['hasReadGroupField'];
- $acl->_hasOwnerField = $conf['hasOwnerField'];
- $_cache[$idZasob] = $acl;
- return $_cache[$idZasob];
- }
- }
|