コード例 #1
0
ファイル: indexmanager.php プロジェクト: mrdeadmouse/u136006
 private function getSimpleRights(BaseObject $object)
 {
     $query = SimpleRightTable::getList(array('select' => array('ACCESS_CODE'), 'filter' => array('OBJECT_ID' => $object->getId())));
     $permissions = array();
     while ($row = $query->fetch()) {
         $permissions[] = $row['ACCESS_CODE'];
     }
     return $permissions;
 }
コード例 #2
0
ファイル: folder.php プロジェクト: mrdeadmouse/u136006
 protected function deleteNonRecursive($deletedBy)
 {
     foreach ($this->getSharingsAsReal() as $sharing) {
         $sharing->delete($deletedBy);
     }
     //with status unreplied, declined (not approved)
     $success = SharingTable::deleteByFilter(array('REAL_OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     SimpleRightTable::deleteBatch(array('OBJECT_ID' => $this->id));
     $success = RightTable::deleteByFilter(array('OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     DeletedLog::addFolder($this, $deletedBy, $this->errorCollection);
     $resultDelete = FolderTable::delete($this->id);
     if (!$resultDelete->isSuccess()) {
         return false;
     }
     if (!$this->isLink()) {
         //todo potential - very hard operation.
         foreach (Folder::getModelList(array('filter' => array('REAL_OBJECT_ID' => $this->id, '!=REAL_OBJECT_ID' => $this->id))) as $link) {
             $link->deleteTree($deletedBy);
         }
         unset($link);
     }
     $event = new Event(Driver::INTERNAL_MODULE_ID, "onAfterDeleteFolder", array($this->getId(), $deletedBy));
     $event->send();
     return true;
 }
コード例 #3
0
ファイル: rightsmanager.php プロジェクト: DarneoStudio/bitrix
 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);
 }
コード例 #4
0
ファイル: file.php プロジェクト: mrdeadmouse/u136006
 /**
  * Deletes file and all connected data and entities (@see Sharing, @see Rights, etc).
  * @param int $deletedBy Id of user.
  * @return bool
  * @throws \Bitrix\Main\ArgumentNullException
  */
 public function delete($deletedBy)
 {
     $this->errorCollection->clear();
     $success = EditSessionTable::deleteByFilter(array('OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     $success = ExternalLinkTable::deleteByFilter(array('OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     foreach ($this->getSharingsAsReal() as $sharing) {
         $sharing->delete($deletedBy);
     }
     //with status unreplied, declined (not approved)
     $success = SharingTable::deleteByFilter(array('REAL_OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     foreach ($this->getAttachedObjects() as $attached) {
         $attached->delete();
     }
     unset($attached);
     BizProcDocument::deleteWorkflowsFile($this->id);
     SimpleRightTable::deleteBatch(array('OBJECT_ID' => $this->id));
     $success = RightTable::deleteByFilter(array('OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     $success = VersionTable::deleteByFilter(array('OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     DeletedLog::addFile($this, $deletedBy, $this->errorCollection);
     \CFile::delete($this->fileId);
     $deleteResult = FileTable::delete($this->id);
     if (!$deleteResult->isSuccess()) {
         return false;
     }
     Driver::getInstance()->getIndexManager()->dropIndex($this);
     if (!$this->isLink()) {
         //todo potential - very hard operation.
         foreach (File::getModelList(array('filter' => array('REAL_OBJECT_ID' => $this->id, '!=REAL_OBJECT_ID' => $this->id))) as $link) {
             $link->delete($deletedBy);
         }
         unset($link);
     }
     $event = new Event(Driver::INTERNAL_MODULE_ID, "onAfterDeleteFile", array($this->getId(), $deletedBy));
     $event->send();
     return true;
 }
コード例 #5
0
ファイル: filelink.php プロジェクト: DarneoStudio/bitrix
 protected function deleteProcess($deletedBy, $withDeletingSharing = true)
 {
     $this->errorCollection->clear();
     $success = EditSessionTable::deleteByFilter(array('OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     $success = ExternalLinkTable::deleteByFilter(array('OBJECT_ID' => $this->id));
     if ($withDeletingSharing) {
         foreach ($this->getSharingsAsLink() as $sharing) {
             $sharing->delete($deletedBy, false);
         }
         //with status unreplied, declined (not approved)
         $success = SharingTable::deleteByFilter(array('REAL_OBJECT_ID' => $this->id));
     }
     if (!$success) {
         return false;
     }
     SimpleRightTable::deleteBatch(array('OBJECT_ID' => $this->id));
     $success = RightTable::deleteByFilter(array('OBJECT_ID' => $this->id));
     if (!$success) {
         return false;
     }
     DeletedLog::addFile($this, $deletedBy, $this->errorCollection);
     $resultDelete = FileTable::delete($this->id);
     if (!$resultDelete->isSuccess()) {
         return false;
     }
     $event = new Event(Driver::INTERNAL_MODULE_ID, "onAfterDeleteFile", array($this->getId(), $deletedBy));
     $event->send();
     return true;
 }