diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index 4017b7ad64..250c1e872e 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -86,7 +86,9 @@ class Shared_Cache extends Cache { public function get($file) { if (is_string($file)) { if ($cache = $this->getSourceCache($file)) { - return $cache->get($this->files[$file]); + $data = $cache->get($this->files[$file]); + $data['displayname_owner'] = \OC_User::getDisplayName($this->storage->getSharedFrom()); + return $data; } } else { // if we are at the root of the mount point we want to return the diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 3fa2540b60..f38f29635a 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -32,6 +32,7 @@ class Shared extends \OC\Files\Storage\Common { private $type; // can be "file" or "folder" private $shareId; // share Id to identify the share in the database private $fileSource; // file cache ID of the shared item + private $sharedFrom; // the user who shared the file private $files = array(); public function __construct($arguments) { @@ -39,6 +40,7 @@ class Shared extends \OC\Files\Storage\Common { $this->type = $arguments['shareType']; $this->shareId = $arguments['shareId']; $this->fileSource = $arguments['fileSource']; + $this->sharedFrom = $arguments['sharedFrom']; } /** @@ -498,6 +500,7 @@ class Shared extends \OC\Files\Storage\Common { 'shareType' => $share['item_type'], 'shareId' => $share['id'], 'fileSource' => $share['file_source'], + 'sharedFrom' => $share['uid_owner'], ), $options['user_dir'] . '/' . $share['file_target']); } @@ -512,6 +515,14 @@ class Shared extends \OC\Files\Storage\Common { return ltrim($this->mountPoint, '/'); } + /** + * @brief get the user who shared the file + * @return string + */ + public function getSharedFrom() { + return $this->sharedFrom; + } + /** * @brief return share type, can be "file" or "folder" * @return string