| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- * $group->primaryKey
- * $group->realName realName eg. "[123] Grupa 123"
- * $group->nestedGroups
- * $group->type 'STANOWISKO','PODMIOT','DZIAL','local','network'
- * (optional) $group->zasobID
- * (optional) $group->zasobDESC
- */
- class ObjectGroup {
- public $primaryKey;
- public $realName;
- public $type;// 'STANOWISKO','PODMIOT','DZIAL','local','network'
- // 'local' - access groups like com.apple.access_mail
- // 'network' - network group: workgroup
- public $nestedGroups;
- public $parentGroups = null;
- public $zasobID;// (optional)
- public $zasobDESC;// (optional)
- protected $_storageName;
- public function __construct($storageName) {
- // TODO: only storage name (clientType) 'DB', 'MacOSX'
- // $usrStorageDB = UserStorageFactory::getStorage('DB');
- // $usrStorageLdap = UserStorageFactory::getStorage('MacOSX');
- $this->_storageName = $storageName;
- }
- public function getParentGroups() {
- if (null === $this->parentGroups) {
- $this->parentGroups = $this->getStorage()->getParentGroups($this);
- }
- return $this->parentGroups;
- }
- public function getStorage() {
- $storage = UserStorageFactory::getStorage($this->_storageName);
- if (!$storage) {
- throw new Exception("Storage '{$this->_storageName}' not exists!");
- }
- return $storage;
- }
- public function exportData() {
- $data = new stdClass();
- $data->primaryKey = $this->primaryKey;
- $data->realName = $this->realName;
- $data->type = $this->type;
- $data->nestedGroups = $this->nestedGroups;
- $data->parentGroups = $this->parentGroups;
- $data->zasobID = $this->zasobID;
- $data->zasobDESC = $this->zasobDESC;
- return $data;
- }
- }
|