private function fillChildren() { if ($this->object instanceof File) { return; } $specificRightsByObjectId = array($this->object->getId() => $this->specificRights); //store all rights on object (all inherited rights) $inheritedRightsByObjectId = array($this->object->getId() => $this->getParentRights()); $childrenRights = Driver::getInstance()->getRightsManager()->getDescendantsRights($this->object->getId()); if (!$childrenRights) { SimpleRightTable::fillDescendants($this->object->getId()); return; } //store all specific rights on object foreach ($childrenRights as $right) { if (!isset($specificRightsByObjectId[$right['OBJECT_ID']])) { $specificRightsByObjectId[$right['OBJECT_ID']] = array(); } $specificRightsByObjectId[$right['OBJECT_ID']][] = $right; } unset($right, $childrenRights); $simpleRightsByObjectId = array($this->object->getId() => $this->simpleRights); $query = ObjectTable::getDescendants($this->object->getId(), array('select' => array('ID', 'PARENT_ID'))); while ($object = $query->fetch()) { //specific rights on object if (!isset($specificRightsByObjectId[$object['ID']])) { $specificRightsByObjectId[$object['ID']] = array(); } if (!isset($inheritedRightsByObjectId[$object['ID']])) { $inheritedRightsByObjectId[$object['ID']] = array(); } if (!isset($simpleRightsByObjectId[$object['PARENT_ID']])) { $simpleRightsByObjectId[$object['PARENT_ID']] = array(); } if (isset($inheritedRightsByObjectId[$object['PARENT_ID']])) { $inheritedRightsByObjectId[$object['ID']] = array_merge($inheritedRightsByObjectId[$object['PARENT_ID']], $specificRightsByObjectId[$object['PARENT_ID']] ?: array()); } else { $inheritedRightsByObjectId[$object['PARENT_ID']] = array(); } $simpleRightsByObjectId[$object['ID']] = $this->uniqualizeSimpleRights($this->getNewSimpleRight($specificRightsByObjectId[$object['ID']], $inheritedRightsByObjectId[$object['ID']], $simpleRightsByObjectId[$object['PARENT_ID']])); $items = array(); foreach ($simpleRightsByObjectId[$object['ID']] as $right) { $items[] = array('OBJECT_ID' => $object['ID'], 'ACCESS_CODE' => $right['ACCESS_CODE']); } unset($right); SimpleRightTable::insertBatch($items); } unset($object); }