summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/appinfo/routes.php5
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php30
2 files changed, 35 insertions, 0 deletions
diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php
index ad3d11fc3a1..1346e0c6899 100644
--- a/apps/files_sharing/appinfo/routes.php
+++ b/apps/files_sharing/appinfo/routes.php
@@ -76,6 +76,11 @@ return [
'verb' => 'POST',
],
[
+ 'name' => 'ShareAPI#pendingShares',
+ 'url' => '/api/v1/shares/pending',
+ 'verb' => 'GET',
+ ],
+ [
'name' => 'ShareAPI#getShare',
'url' => '/api/v1/shares/{id}',
'verb' => 'GET',
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 906eb82221b..e7c9a414958 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -1081,6 +1081,36 @@ class ShareAPIController extends OCSController {
/**
* @NoAdminRequired
+ */
+ public function pendingShares(): DataResponse {
+ $pendingShares = [];
+
+ $shareTypes = [
+ IShare::TYPE_USER,
+ IShare::TYPE_GROUP
+ ];
+
+ foreach ($shareTypes as $shareType) {
+ $shares = $this->shareManager->getSharedWith($this->currentUser, $shareType, null, -1, 0);
+
+ foreach ($shares as $share) {
+ if ($share->getStatus() === IShare::STATUS_PENDING || $share->getStatus() === IShare::STATUS_REJECTED) {
+ $pendingShares[] = $share;
+ }
+ }
+ }
+
+ $result = array_map(function (IShare $share) {
+ return [
+ 'id' => $share->getFullId(),
+ ];
+ }, $pendingShares);
+
+ return new DataResponse($result);
+ }
+
+ /**
+ * @NoAdminRequired
*
* @param string $id
* @return DataResponse