Skip to content

Commit 9e455f0

Browse files
authored
Merge pull request #56032 from nextcloud/carl/share-manager-correct-return-type
refactor(share-manager): Make return type more precise
2 parents 3cdfe6d + 8bbd306 commit 9e455f0

File tree

2 files changed

+12
-52
lines changed

2 files changed

+12
-52
lines changed

lib/private/Share20/Manager.php

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,54 +1600,7 @@ public function userDeletedFromGroup($uid, $gid) {
16001600
}
16011601
}
16021602

1603-
/**
1604-
* Get access list to a path. This means
1605-
* all the users that can access a given path.
1606-
*
1607-
* Consider:
1608-
* -root
1609-
* |-folder1 (23)
1610-
* |-folder2 (32)
1611-
* |-fileA (42)
1612-
*
1613-
* fileA is shared with user1 and user1@server1 and email1@maildomain1
1614-
* folder2 is shared with group2 (user4 is a member of group2)
1615-
* folder1 is shared with user2 (renamed to "folder (1)") and user2@server2
1616-
* and email2@maildomain2
1617-
*
1618-
* Then the access list to '/folder1/folder2/fileA' with $currentAccess is:
1619-
* [
1620-
* users => [
1621-
* 'user1' => ['node_id' => 42, 'node_path' => '/fileA'],
1622-
* 'user4' => ['node_id' => 32, 'node_path' => '/folder2'],
1623-
* 'user2' => ['node_id' => 23, 'node_path' => '/folder (1)'],
1624-
* ],
1625-
* remote => [
1626-
* 'user1@server1' => ['node_id' => 42, 'token' => 'SeCr3t'],
1627-
* 'user2@server2' => ['node_id' => 23, 'token' => 'FooBaR'],
1628-
* ],
1629-
* public => bool
1630-
* mail => [
1631-
* 'email1@maildomain1' => ['node_id' => 42, 'token' => 'aBcDeFg'],
1632-
* 'email2@maildomain2' => ['node_id' => 23, 'token' => 'hIjKlMn'],
1633-
* ]
1634-
* ]
1635-
*
1636-
* The access list to '/folder1/folder2/fileA' **without** $currentAccess is:
1637-
* [
1638-
* users => ['user1', 'user2', 'user4'],
1639-
* remote => bool,
1640-
* public => bool
1641-
* mail => ['email1@maildomain1', 'email2@maildomain2']
1642-
* ]
1643-
*
1644-
* This is required for encryption/activity
1645-
*
1646-
* @param \OCP\Files\Node $path
1647-
* @param bool $recursive Should we check all parent folders as well
1648-
* @param bool $currentAccess Ensure the recipient has access to the file (e.g. did not unshare it)
1649-
* @return array
1650-
*/
1603+
#[\Override]
16511604
public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false) {
16521605
$owner = $path->getOwner();
16531606

lib/public/Share/IManager.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,15 @@ public function userDeletedFromGroup($uid, $gid);
273273
* @param \OCP\Files\Node $path
274274
* @param bool $recursive Should we check all parent folders as well
275275
* @param bool $currentAccess Should the user have currently access to the file
276-
* @return array
277-
* @since 12
276+
* @return ($currentAccess is true
277+
* ? array{
278+
* users?: array<string, array{node_id: int, node_path: string}>,
279+
* remote?: array<string, array{node_id: int, node_path: string}>,
280+
* public?: bool,
281+
* mail?: array<string, array{node_id: int, node_path: string}>
282+
* }
283+
* : array{users?: list<string>, remote?: bool, public?: bool, mail?: list<string>})
284+
* @since 12.0.0
278285
*/
279286
public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false);
280287

@@ -545,9 +552,9 @@ public function registerShareProvider(string $shareProviderClass): void;
545552
*
546553
* Get all the shares as iterable to reduce memory overhead
547554
* Note, since this opens up database cursors the iterable should
548-
* be fully itterated.
555+
* be fully iterated.
549556
*
550-
* @return iterable
557+
* @return iterable<IShare>
551558
* @since 18.0.0
552559
*/
553560
public function getAllShares(): iterable;

0 commit comments

Comments
 (0)