Skip to content
Snippets Groups Projects
Commit dbbb6c59 authored by Björn Schießle's avatar Björn Schießle Committed by Vincent Petry
Browse files

extend OCS Share API to allow the user to ask for files shared with him

parent 929882a3
Branches
No related tags found
No related merge requests found
...@@ -31,6 +31,9 @@ class Api { ...@@ -31,6 +31,9 @@ class Api {
* @return \OC_OCS_Result share information * @return \OC_OCS_Result share information
*/ */
public static function getAllShares($params) { public static function getAllShares($params) {
if (isset($_GET['shared_with_me']) && $_GET['shared_with_me'] !== 'false') {
return self::getFilesSharedWithMe();
}
// if a file is specified, get the share for this file // if a file is specified, get the share for this file
if (isset($_GET['path'])) { if (isset($_GET['path'])) {
$params['itemSource'] = self::getFileId($_GET['path']); $params['itemSource'] = self::getFileId($_GET['path']);
...@@ -195,6 +198,22 @@ class Api { ...@@ -195,6 +198,22 @@ class Api {
return new \OC_OCS_Result($result); return new \OC_OCS_Result($result);
} }
/**
* get files shared with the user
* @return \OC_OCS_Result
*/
private static function getFilesSharedWithMe() {
try {
$shares = \OCP\Share::getItemsSharedWith('file');
$result = new \OC_OCS_Result($shares);
} catch (\Exception $e) {
$result = new \OC_OCS_Result(null, 403, $e->getMessage());
}
return $result;
}
/** /**
* create a new share * create a new share
* @param array $params * @param array $params
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment