| @@ 115-137 (lines=23) @@ | ||
| 112 | * |
|
| 113 | * @return int[] array of share types |
|
| 114 | */ |
|
| 115 | private function getShareTypes(\OCP\Files\Node $node) { |
|
| 116 | $shareTypes = []; |
|
| 117 | $requestedShareTypes = [ |
|
| 118 | \OCP\Share::SHARE_TYPE_USER, |
|
| 119 | \OCP\Share::SHARE_TYPE_GROUP, |
|
| 120 | \OCP\Share::SHARE_TYPE_LINK, |
|
| 121 | \OCP\Share::SHARE_TYPE_REMOTE |
|
| 122 | ]; |
|
| 123 | foreach ($requestedShareTypes as $requestedShareType) { |
|
| 124 | // one of each type is enough to find out about the types |
|
| 125 | $shares = $this->shareManager->getSharesBy( |
|
| 126 | $this->userId, |
|
| 127 | $requestedShareType, |
|
| 128 | $node, |
|
| 129 | false, |
|
| 130 | 1 |
|
| 131 | ); |
|
| 132 | if (!empty($shares)) { |
|
| 133 | $shareTypes[] = $requestedShareType; |
|
| 134 | } |
|
| 135 | } |
|
| 136 | return $shareTypes; |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Adds shares to propfind response |
|
| @@ 196-219 (lines=24) @@ | ||
| 193 | * |
|
| 194 | * @return int[] array of share types |
|
| 195 | */ |
|
| 196 | private function getShareTypes(Node $node) { |
|
| 197 | $userId = $this->userSession->getUser()->getUID(); |
|
| 198 | $shareTypes = []; |
|
| 199 | $requestedShareTypes = [ |
|
| 200 | \OCP\Share::SHARE_TYPE_USER, |
|
| 201 | \OCP\Share::SHARE_TYPE_GROUP, |
|
| 202 | \OCP\Share::SHARE_TYPE_LINK, |
|
| 203 | \OCP\Share::SHARE_TYPE_REMOTE |
|
| 204 | ]; |
|
| 205 | foreach ($requestedShareTypes as $requestedShareType) { |
|
| 206 | // one of each type is enough to find out about the types |
|
| 207 | $shares = $this->shareManager->getSharesBy( |
|
| 208 | $userId, |
|
| 209 | $requestedShareType, |
|
| 210 | $node, |
|
| 211 | false, |
|
| 212 | 1 |
|
| 213 | ); |
|
| 214 | if (!empty($shares)) { |
|
| 215 | $shareTypes[] = $requestedShareType; |
|
| 216 | } |
|
| 217 | } |
|
| 218 | return $shareTypes; |
|
| 219 | } |
|
| 220 | ||
| 221 | /** |
|
| 222 | * Change the default sort mode |
|