mirror of
https://github.com/nextcloud/server.git
synced 2024-08-30 17:57:26 +02:00
getDeletedSharedWith method
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
d805959e81
commit
6a0552224d
@ -73,17 +73,7 @@ class DeletedShareAPIController extends OCSController {
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function index(): DataResponse {
|
||||
$shares = $this->shareManager->getSharedWith($this->userId, \OCP\Share::SHARE_TYPE_GROUP, null, -1, 0);
|
||||
|
||||
// Only get deleted shares
|
||||
$shares = array_filter($shares, function(IShare $share) {
|
||||
return $share->getPermissions() === 0;
|
||||
});
|
||||
|
||||
// Only get shares where the owner still exists
|
||||
$shares = array_filter($shares, function (IShare $share) {
|
||||
return $this->userManager->userExists($share->getShareOwner());
|
||||
});
|
||||
$shares = $this->shareManager->getDeletedSharedWith($this->userId, \OCP\Share::SHARE_TYPE_GROUP, null, -1, 0);
|
||||
|
||||
$shares = array_map(function (IShare $share) {
|
||||
return $this->formatShare($share);
|
||||
|
@ -1129,6 +1129,25 @@ class Manager implements IManager {
|
||||
return $shares;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getDeletedSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0) {
|
||||
$shares = $this->getSharedWith($userId, $shareType, $node, $limit, $offset);
|
||||
|
||||
// Only get deleted shares
|
||||
$shares = array_filter($shares, function(IShare $share) {
|
||||
return $share->getPermissions() === 0;
|
||||
});
|
||||
|
||||
// Only get shares where the owner still exists
|
||||
$shares = array_filter($shares, function (IShare $share) {
|
||||
return $this->userManager->userExists($share->getShareOwner());
|
||||
});
|
||||
|
||||
return $shares;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
|
@ -149,6 +149,20 @@ interface IManager {
|
||||
*/
|
||||
public function getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0);
|
||||
|
||||
/**
|
||||
* Get deleted shares shared with $user.
|
||||
* Filter by $node if provided
|
||||
*
|
||||
* @param string $userId
|
||||
* @param int $shareType
|
||||
* @param Node|null $node
|
||||
* @param int $limit The maximum number of shares returned, -1 for all
|
||||
* @param int $offset
|
||||
* @return IShare[]
|
||||
* @since 9.0.0
|
||||
*/
|
||||
public function getDeletedSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0);
|
||||
|
||||
/**
|
||||
* Retrieve a share by the share id.
|
||||
* If the recipient is set make sure to retrieve the file for that user.
|
||||
|
Loading…
Reference in New Issue
Block a user