@@ -44,10 +44,6 @@ public function __construct(
4444 IRequest $ request ,
4545 private FederatedShareProvider $ federatedShareProvider ,
4646 private IDBConnection $ connection ,
47- private Share \IManager $ shareManager ,
48- private Notifications $ notifications ,
49- private AddressHandler $ addressHandler ,
50- private IUserManager $ userManager ,
5147 private ICloudIdManager $ cloudIdManager ,
5248 private LoggerInterface $ logger ,
5349 private ICloudFederationFactory $ cloudFederationFactory ,
@@ -66,10 +62,10 @@ public function __construct(
6662 * @param string|null $owner Display name of the receiver
6763 * @param string|null $sharedBy Display name of the sender
6864 * @param string|null $shareWith ID of the user that receives the share
69- * @param int |null $remoteId ID of the remote
65+ * @param string |null $remoteId ID of the remote
7066 * @param string|null $sharedByFederatedId Federated ID of the sender
7167 * @param string|null $ownerFederatedId Federated ID of the receiver
72- * @return Http\ DataResponse<Http::STATUS_OK, list<empty>, array{}>
68+ * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
7369 * @throws OCSException
7470 *
7571 * 200: Share created successfully
@@ -83,10 +79,10 @@ public function createShare(
8379 ?string $ owner = null ,
8480 ?string $ sharedBy = null ,
8581 ?string $ shareWith = null ,
86- ?int $ remoteId = null ,
82+ ?string $ remoteId = null ,
8783 ?string $ sharedByFederatedId = null ,
8884 ?string $ ownerFederatedId = null ,
89- ) {
85+ ): DataResponse {
9086 if ($ ownerFederatedId === null ) {
9187 $ ownerFederatedId = $ this ->cloudIdManager ->getCloudId ($ owner , $ this ->cleanupRemote ($ remote ))->getId ();
9288 }
@@ -132,19 +128,19 @@ public function createShare(
132128 /**
133129 * create re-share on behalf of another user
134130 *
135- * @param int $id ID of the share
131+ * @param string $id ID of the share
136132 * @param string|null $token Shared secret between servers
137133 * @param string|null $shareWith ID of the user that receives the share
138134 * @param int|null $remoteId ID of the remote
139- * @return Http\ DataResponse<Http::STATUS_OK, array{token: string, remoteId: string}, array{}>
135+ * @return DataResponse<Http::STATUS_OK, array{token: string, remoteId: string}, array{}>
140136 * @throws OCSBadRequestException Re-sharing is not possible
141137 * @throws OCSException
142138 *
143139 * 200: Remote share returned
144140 */
145141 #[NoCSRFRequired]
146142 #[PublicPage]
147- public function reShare (int $ id , ?string $ token = null , ?string $ shareWith = null , ?int $ remoteId = 0 ) {
143+ public function reShare (string $ id , ?string $ token = null , ?string $ shareWith = null , ?int $ remoteId = 0 ): DataResponse {
148144 if ($ token === null
149145 || $ shareWith === null
150146 || $ remoteId === null
@@ -181,9 +177,9 @@ public function reShare(int $id, ?string $token = null, ?string $shareWith = nul
181177 /**
182178 * accept server-to-server share
183179 *
184- * @param int $id ID of the remote share
180+ * @param string $id ID of the remote share
185181 * @param string|null $token Shared secret between servers
186- * @return Http\ DataResponse<Http::STATUS_OK, list<empty>, array{}>
182+ * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
187183 * @throws OCSException
188184 * @throws ShareNotFound
189185 * @throws HintException
@@ -192,7 +188,7 @@ public function reShare(int $id, ?string $token = null, ?string $shareWith = nul
192188 */
193189 #[NoCSRFRequired]
194190 #[PublicPage]
195- public function acceptShare (int $ id , ?string $ token = null ) {
191+ public function acceptShare (string $ id , ?string $ token = null ): DataResponse {
196192 $ notification = [
197193 'sharedSecret ' => $ token ,
198194 'message ' => 'Recipient accept the share '
@@ -216,16 +212,16 @@ public function acceptShare(int $id, ?string $token = null) {
216212 /**
217213 * decline server-to-server share
218214 *
219- * @param int $id ID of the remote share
215+ * @param string $id ID of the remote share
220216 * @param string|null $token Shared secret between servers
221- * @return Http\ DataResponse<Http::STATUS_OK, list<empty>, array{}>
217+ * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
222218 * @throws OCSException
223219 *
224220 * 200: Share declined successfully
225221 */
226222 #[NoCSRFRequired]
227223 #[PublicPage]
228- public function declineShare (int $ id , ?string $ token = null ) {
224+ public function declineShare (string $ id , ?string $ token = null ) {
229225 $ notification = [
230226 'sharedSecret ' => $ token ,
231227 'message ' => 'Recipient declined the share '
@@ -249,16 +245,16 @@ public function declineShare(int $id, ?string $token = null) {
249245 /**
250246 * remove server-to-server share if it was unshared by the owner
251247 *
252- * @param int $id ID of the share
248+ * @param string $id ID of the share
253249 * @param string|null $token Shared secret between servers
254- * @return Http\ DataResponse<Http::STATUS_OK, list<empty>, array{}>
250+ * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
255251 * @throws OCSException
256252 *
257253 * 200: Share unshared successfully
258254 */
259255 #[NoCSRFRequired]
260256 #[PublicPage]
261- public function unshare (int $ id , ?string $ token = null ) {
257+ public function unshare (string $ id , ?string $ token = null ) {
262258 if (!$ this ->isS2SEnabled ()) {
263259 throw new OCSException ('Server does not support federated cloud sharing ' , 503 );
264260 }
@@ -275,7 +271,7 @@ public function unshare(int $id, ?string $token = null) {
275271 return new DataResponse ();
276272 }
277273
278- private function cleanupRemote ($ remote ) {
274+ private function cleanupRemote (string $ remote ): string {
279275 $ remote = substr ($ remote , strpos ($ remote , ':// ' ) + 3 );
280276
281277 return rtrim ($ remote , '/ ' );
@@ -285,16 +281,16 @@ private function cleanupRemote($remote) {
285281 /**
286282 * federated share was revoked, either by the owner or the re-sharer
287283 *
288- * @param int $id ID of the share
284+ * @param string $id ID of the share
289285 * @param string|null $token Shared secret between servers
290- * @return Http\ DataResponse<Http::STATUS_OK, list<empty>, array{}>
286+ * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
291287 * @throws OCSBadRequestException Revoking the share is not possible
292288 *
293289 * 200: Share revoked successfully
294290 */
295291 #[NoCSRFRequired]
296292 #[PublicPage]
297- public function revoke (int $ id , ?string $ token = null ) {
293+ public function revoke (string $ id , ?string $ token = null ) {
298294 try {
299295 $ provider = $ this ->cloudFederationProviderManager ->getCloudFederationProvider ('file ' );
300296 $ notification = ['sharedSecret ' => $ token ];
@@ -324,19 +320,19 @@ private function isS2SEnabled($incoming = false) {
324320 }
325321
326322 /**
327- * update share information to keep federated re-shares in sync
323+ * Update share information to keep federated re-shares in sync.
328324 *
329- * @param int $id ID of the share
325+ * @param string $id ID of the share
330326 * @param string|null $token Shared secret between servers
331327 * @param int|null $permissions New permissions
332- * @return Http\ DataResponse<Http::STATUS_OK, list<empty>, array{}>
328+ * @return DataResponse<Http::STATUS_OK, list<empty>, array{}>
333329 * @throws OCSBadRequestException Updating permissions is not possible
334330 *
335331 * 200: Permissions updated successfully
336332 */
337333 #[NoCSRFRequired]
338334 #[PublicPage]
339- public function updatePermissions (int $ id , ?string $ token = null , ?int $ permissions = null ) {
335+ public function updatePermissions (string $ id , ?string $ token = null , ?int $ permissions = null ) {
340336 $ ncPermissions = $ permissions ;
341337
342338 try {
@@ -385,7 +381,7 @@ protected function ncPermissions2ocmPermissions($ncPermissions) {
385381 * @param string|null $token Shared secret between servers
386382 * @param string|null $remote Address of the remote
387383 * @param string|null $remote_id ID of the remote
388- * @return Http\ DataResponse<Http::STATUS_OK, array{remote: string, owner: string}, array{}>
384+ * @return DataResponse<Http::STATUS_OK, array{remote: string, owner: string}, array{}>
389385 * @throws OCSBadRequestException Moving share is not possible
390386 *
391387 * 200: Share moved successfully
0 commit comments