public static function onSocNetGroupDelete($groupId)
 {
     $storage = Driver::getInstance()->getStorageByGroupId($groupId);
     if (!$storage) {
         return;
     }
     $storage->delete(self::getActivityUserId());
     RightTable::deleteBatch(array('ACCESS_CODE' => "SG{$groupId}_" . SONET_ROLES_OWNER));
     RightTable::deleteBatch(array('ACCESS_CODE' => "SG{$groupId}_" . SONET_ROLES_MODERATOR));
     RightTable::deleteBatch(array('ACCESS_CODE' => "SG{$groupId}_" . SONET_ROLES_USER));
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 /**
  * 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;
 }
Esempio n. 4
0
 private function deleteOneNegative(array $right)
 {
     $result = RightTable::delete($right['ID']);
     if ($result->isSuccess()) {
         $this->errorCollection->addFromResult($result);
         return false;
     }
     $firstNegative = false;
     foreach ($this->getParentRights() as $parentRight) {
         if ($this->isEqual($parentRight, $right)) {
             $firstNegative = true;
             break;
         }
         if ($this->isOpposite($parentRight, $right)) {
             $firstNegative = false;
             break;
         }
     }
     if ($firstNegative) {
         //parent negative is like current negative right ($right)
         return true;
     }
     /**
      * Insert all simple rights in sub-tree before positive rights and negative rights.
      */
     return true;
 }
Esempio n. 5
0
 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;
 }