Skip to content
Snippets Groups Projects
Unverified Commit fbed6a34 authored by Roeland Jago Douma's avatar Roeland Jago Douma
Browse files

A pending shares overview


Now that we accept shares we should show an overview of shares that are
pending. This first part is the small API to get a list of the currently
pending shares.

Signed-off-by: default avatarRoeland Jago Douma <roeland@famdouma.nl>
parent 4c841559
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,11 @@ return [
'url' => '/api/v1/shares',
'verb' => 'POST',
],
[
'name' => 'ShareAPI#pendingShares',
'url' => '/api/v1/shares/pending',
'verb' => 'GET',
],
[
'name' => 'ShareAPI#getShare',
'url' => '/api/v1/shares/{id}',
......
......@@ -1079,6 +1079,36 @@ class ShareAPIController extends OCSController {
return new DataResponse($this->formatShare($share));
}
/**
* @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
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment