Example #1
0
 /**
  * Add notifications for the owners whose files have been reshared
  *
  * @param string $currentOwner
  * @param string $subject
  * @param string $shareWith
  * @param int $fileSource
  * @param string $itemType
  */
 protected function shareNotificationForOriginalOwners($currentOwner, $subject, $shareWith, $fileSource, $itemType)
 {
     // Get the full path of the current user
     $this->view->chroot('/' . $currentOwner . '/files');
     try {
         $path = $this->view->getPath($fileSource);
     } catch (NotFoundException $e) {
         return;
     }
     /**
      * Get the original owner and his path
      */
     $owner = $this->view->getOwner($path);
     if ($owner !== $currentOwner) {
         $this->reshareNotificationForSharer($owner, $subject, $shareWith, $fileSource, $itemType);
     }
     /**
      * Get the sharee who shared the item with the currentUser
      */
     $this->view->chroot('/' . $currentOwner . '/files');
     $mount = $this->view->getMount($path);
     if (!$mount instanceof IMountPoint) {
         return;
     }
     $storage = $mount->getStorage();
     if (!$storage->instanceOfStorage('OC\\Files\\Storage\\Shared')) {
         return;
     }
     /** @var \OC\Files\Storage\Shared $storage */
     $shareOwner = $storage->getSharedFrom();
     if ($shareOwner === '' || $shareOwner === null || $shareOwner === $owner || $shareOwner === $currentOwner) {
         return;
     }
     $this->reshareNotificationForSharer($shareOwner, $subject, $shareWith, $fileSource, $itemType);
 }
Example #2
0
 /**
  * Get the owner for a file or folder
  *
  * @param string $path
  * @return string
  */
 public static function getOwner($path)
 {
     return self::$defaultInstance->getOwner($path);
 }
Example #3
0
 /**
  * @param string $message
  * @param int $id optional
  * @param string $path optional
  */
 public function logError($message, $id = null, $path = null)
 {
     $ownerInfo = is_null($this->view) ? '' : 'Account: ' . $this->view->getOwner($path);
     $extra = ' File: ' . (is_null($id) ? $this->id : $id) . $ownerInfo . ' Path: ' . (is_null($path) ? $this->path : $path);
     \OCP\Util::writeLog('files_antivirus', $message . $extra, \OCP\Util::ERROR);
 }