add commands to list shares and set share owner#38489
add commands to list shares and set share owner#38489icewind1991 wants to merge 1 commit intomasterfrom
Conversation
Signed-off-by: Robin Appelman <robin@icewind.nl>
|
|
||
| $allShares = $this->shareManager->getAllShares(); | ||
|
|
||
| $filteredShares = new \CallbackFilterIterator($allShares, function(IShare $share) use ($ownerInput, $shareType, $sharedByInput, $sharedWithInput, $fileInput) { |
Check failure
Code scanning / Psalm
InvalidArgument
| return 1; | ||
| } | ||
|
|
||
| if (!$targetHasNonSharedAccess && $targetHasSharedAccess) { |
Check failure
Code scanning / Psalm
RedundantCondition
|
|
||
| $allShares = $this->shareManager->getAllShares(); | ||
|
|
||
| $filteredShares = new \CallbackFilterIterator($allShares, function(IShare $share) use ($ownerInput, $shareType, $sharedByInput, $sharedWithInput, $fileInput) { |
Check notice
Code scanning / Psalm
PossiblyUndefinedVariable
| } | ||
|
|
||
| $share = $this->shareManager->getShareById($shareId); | ||
| if (!$share) { |
Check notice
Code scanning / Psalm
DocblockTypeContradiction
There was a problem hiding this comment.
Replace by try/catch or remove
| } | ||
|
|
||
| $share = $this->shareManager->getShareById($shareId); | ||
| if (!$share) { |
Check notice
Code scanning / Psalm
DocblockTypeContradiction
| return 1; | ||
| } | ||
|
|
||
| $share->setNode($targetNode); |
Check notice
Code scanning / Psalm
PossiblyNullArgument
| return 1; | ||
| } | ||
| } else { | ||
| $shareTypeInput = null; |
There was a problem hiding this comment.
| $shareTypeInput = null; | |
| $shareType = null; |
| }); | ||
|
|
||
| $shareData = []; | ||
| foreach ($filteredShares as $share) { |
There was a problem hiding this comment.
I think the easiest to avoid type problems with the iterable is to just call filterShare in an if there and continue.
| string $ownerInput = null, | ||
| string $sharedByInput = null, | ||
| string $sharedWithInput = null, | ||
| int $shareType = null, | ||
| int $fileInput = null |
There was a problem hiding this comment.
Why the default values?
If it’s just to get nullable types prefix type with ? instead.
| } | ||
|
|
||
| $share = $this->shareManager->getShareById($shareId); | ||
| if (!$share) { |
There was a problem hiding this comment.
Replace by try/catch or remove
|
|
||
| $targetHasNonSharedAccess = false; | ||
| $targetHasSharedAccess = false; | ||
| $fileOrFolder = ($sourceFile instanceof File) ? "file" : "folder";; |
There was a problem hiding this comment.
| $fileOrFolder = ($sourceFile instanceof File) ? "file" : "folder";; | |
| $fileOrFolder = ($sourceFile instanceof File) ? "file" : "folder"; |
| return 1; | ||
| } | ||
|
|
||
| if (!$targetHasNonSharedAccess && $targetHasSharedAccess) { |
There was a problem hiding this comment.
| if (!$targetHasNonSharedAccess && $targetHasSharedAccess) { | |
| if (!$targetHasNonSharedAccess) { |
Use case is for setups where multiple users have access to the same set of files (group folders/external storage/etc) and the admins wants to transfer the shares from a user that is being deleted to another user that still has access.