@@ -35,313 +35,313 @@ |
||
35 | 35 | */ |
36 | 36 | interface IManager { |
37 | 37 | |
38 | - /** |
|
39 | - * Create a Share |
|
40 | - * |
|
41 | - * @param IShare $share |
|
42 | - * @return IShare The share object |
|
43 | - * @throws \Exception |
|
44 | - * @since 9.0.0 |
|
45 | - */ |
|
46 | - public function createShare(IShare $share); |
|
47 | - |
|
48 | - /** |
|
49 | - * Update a share. |
|
50 | - * The target of the share can't be changed this way: use moveShare |
|
51 | - * The share can't be removed this way (permission 0): use deleteShare |
|
52 | - * |
|
53 | - * @param IShare $share |
|
54 | - * @return IShare The share object |
|
55 | - * @throws \InvalidArgumentException |
|
56 | - * @since 9.0.0 |
|
57 | - */ |
|
58 | - public function updateShare(IShare $share); |
|
59 | - |
|
60 | - /** |
|
61 | - * Delete a share |
|
62 | - * |
|
63 | - * @param IShare $share |
|
64 | - * @throws ShareNotFound |
|
65 | - * @throws \InvalidArgumentException |
|
66 | - * @since 9.0.0 |
|
67 | - */ |
|
68 | - public function deleteShare(IShare $share); |
|
69 | - |
|
70 | - /** |
|
71 | - * Unshare a file as the recipient. |
|
72 | - * This can be different from a regular delete for example when one of |
|
73 | - * the users in a groups deletes that share. But the provider should |
|
74 | - * handle this. |
|
75 | - * |
|
76 | - * @param IShare $share |
|
77 | - * @param string $recipientId |
|
78 | - * @since 9.0.0 |
|
79 | - */ |
|
80 | - public function deleteFromSelf(IShare $share, $recipientId); |
|
81 | - |
|
82 | - /** |
|
83 | - * Move the share as a recipient of the share. |
|
84 | - * This is updating the share target. So where the recipient has the share mounted. |
|
85 | - * |
|
86 | - * @param IShare $share |
|
87 | - * @param string $recipientId |
|
88 | - * @return IShare |
|
89 | - * @throws \InvalidArgumentException If $share is a link share or the $recipient does not match |
|
90 | - * @since 9.0.0 |
|
91 | - */ |
|
92 | - public function moveShare(IShare $share, $recipientId); |
|
93 | - |
|
94 | - /** |
|
95 | - * Get all shares shared by (initiated) by the provided user in a folder. |
|
96 | - * |
|
97 | - * @param string $userId |
|
98 | - * @param Folder $node |
|
99 | - * @param bool $reshares |
|
100 | - * @return IShare[][] [$fileId => IShare[], ...] |
|
101 | - * @since 11.0.0 |
|
102 | - */ |
|
103 | - public function getSharesInFolder($userId, Folder $node, $reshares = false); |
|
104 | - |
|
105 | - /** |
|
106 | - * Get shares shared by (initiated) by the provided user. |
|
107 | - * |
|
108 | - * @param string $userId |
|
109 | - * @param int $shareType |
|
110 | - * @param Node|null $path |
|
111 | - * @param bool $reshares |
|
112 | - * @param int $limit The maximum number of returned results, -1 for all results |
|
113 | - * @param int $offset |
|
114 | - * @return IShare[] |
|
115 | - * @since 9.0.0 |
|
116 | - */ |
|
117 | - public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0); |
|
118 | - |
|
119 | - /** |
|
120 | - * Get shares shared with $user. |
|
121 | - * Filter by $node if provided |
|
122 | - * |
|
123 | - * @param string $userId |
|
124 | - * @param int $shareType |
|
125 | - * @param Node|null $node |
|
126 | - * @param int $limit The maximum number of shares returned, -1 for all |
|
127 | - * @param int $offset |
|
128 | - * @return IShare[] |
|
129 | - * @since 9.0.0 |
|
130 | - */ |
|
131 | - public function getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0); |
|
132 | - |
|
133 | - /** |
|
134 | - * Retrieve a share by the share id. |
|
135 | - * If the recipient is set make sure to retrieve the file for that user. |
|
136 | - * This makes sure that if a user has moved/deleted a group share this |
|
137 | - * is reflected. |
|
138 | - * |
|
139 | - * @param string $id |
|
140 | - * @param string|null $recipient userID of the recipient |
|
141 | - * @return IShare |
|
142 | - * @throws ShareNotFound |
|
143 | - * @since 9.0.0 |
|
144 | - */ |
|
145 | - public function getShareById($id, $recipient = null); |
|
146 | - |
|
147 | - /** |
|
148 | - * Get the share by token possible with password |
|
149 | - * |
|
150 | - * @param string $token |
|
151 | - * @return IShare |
|
152 | - * @throws ShareNotFound |
|
153 | - * @since 9.0.0 |
|
154 | - */ |
|
155 | - public function getShareByToken($token); |
|
156 | - |
|
157 | - /** |
|
158 | - * Verify the password of a public share |
|
159 | - * |
|
160 | - * @param IShare $share |
|
161 | - * @param string $password |
|
162 | - * @return bool |
|
163 | - * @since 9.0.0 |
|
164 | - */ |
|
165 | - public function checkPassword(IShare $share, $password); |
|
166 | - |
|
167 | - /** |
|
168 | - * The user with UID is deleted. |
|
169 | - * All share providers have to cleanup the shares with this user as well |
|
170 | - * as shares owned by this user. |
|
171 | - * Shares only initiated by this user are fine. |
|
172 | - * |
|
173 | - * @param string $uid |
|
174 | - * @since 9.1.0 |
|
175 | - */ |
|
176 | - public function userDeleted($uid); |
|
177 | - |
|
178 | - /** |
|
179 | - * The group with $gid is deleted |
|
180 | - * We need to clear up all shares to this group |
|
181 | - * |
|
182 | - * @param string $gid |
|
183 | - * @since 9.1.0 |
|
184 | - */ |
|
185 | - public function groupDeleted($gid); |
|
186 | - |
|
187 | - /** |
|
188 | - * The user $uid is deleted from the group $gid |
|
189 | - * All user specific group shares have to be removed |
|
190 | - * |
|
191 | - * @param string $uid |
|
192 | - * @param string $gid |
|
193 | - * @since 9.1.0 |
|
194 | - */ |
|
195 | - public function userDeletedFromGroup($uid, $gid); |
|
196 | - |
|
197 | - /** |
|
198 | - * Get access list to a path. This means |
|
199 | - * all the users that can access a given path. |
|
200 | - * |
|
201 | - * Consider: |
|
202 | - * -root |
|
203 | - * |-folder1 (23) |
|
204 | - * |-folder2 (32) |
|
205 | - * |-fileA (42) |
|
206 | - * |
|
207 | - * fileA is shared with user1 and user1@server1 |
|
208 | - * folder2 is shared with group2 (user4 is a member of group2) |
|
209 | - * folder1 is shared with user2 (renamed to "folder (1)") and user2@server2 |
|
210 | - * |
|
211 | - * Then the access list to '/folder1/folder2/fileA' with $currentAccess is: |
|
212 | - * [ |
|
213 | - * users => [ |
|
214 | - * 'user1' => ['node_id' => 42, 'node_path' => '/fileA'], |
|
215 | - * 'user4' => ['node_id' => 32, 'node_path' => '/folder2'], |
|
216 | - * 'user2' => ['node_id' => 23, 'node_path' => '/folder (1)'], |
|
217 | - * ], |
|
218 | - * remote => [ |
|
219 | - * 'user1@server1' => ['node_id' => 42, 'token' => 'SeCr3t'], |
|
220 | - * 'user2@server2' => ['node_id' => 23, 'token' => 'FooBaR'], |
|
221 | - * ], |
|
222 | - * public => bool |
|
223 | - * mail => bool |
|
224 | - * ] |
|
225 | - * |
|
226 | - * The access list to '/folder1/folder2/fileA' **without** $currentAccess is: |
|
227 | - * [ |
|
228 | - * users => ['user1', 'user2', 'user4'], |
|
229 | - * remote => bool, |
|
230 | - * public => bool |
|
231 | - * mail => bool |
|
232 | - * ] |
|
233 | - * |
|
234 | - * This is required for encryption/activity |
|
235 | - * |
|
236 | - * @param \OCP\Files\Node $path |
|
237 | - * @param bool $recursive Should we check all parent folders as well |
|
238 | - * @param bool $currentAccess Should the user have currently access to the file |
|
239 | - * @return array |
|
240 | - * @since 12 |
|
241 | - */ |
|
242 | - public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false); |
|
243 | - |
|
244 | - /** |
|
245 | - * Instantiates a new share object. This is to be passed to |
|
246 | - * createShare. |
|
247 | - * |
|
248 | - * @return IShare |
|
249 | - * @since 9.0.0 |
|
250 | - */ |
|
251 | - public function newShare(); |
|
252 | - |
|
253 | - /** |
|
254 | - * Is the share API enabled |
|
255 | - * |
|
256 | - * @return bool |
|
257 | - * @since 9.0.0 |
|
258 | - */ |
|
259 | - public function shareApiEnabled(); |
|
260 | - |
|
261 | - /** |
|
262 | - * Is public link sharing enabled |
|
263 | - * |
|
264 | - * @return bool |
|
265 | - * @since 9.0.0 |
|
266 | - */ |
|
267 | - public function shareApiAllowLinks(); |
|
268 | - |
|
269 | - /** |
|
270 | - * Is password on public link requires |
|
271 | - * |
|
272 | - * @return bool |
|
273 | - * @since 9.0.0 |
|
274 | - */ |
|
275 | - public function shareApiLinkEnforcePassword(); |
|
276 | - |
|
277 | - /** |
|
278 | - * Is default expire date enabled |
|
279 | - * |
|
280 | - * @return bool |
|
281 | - * @since 9.0.0 |
|
282 | - */ |
|
283 | - public function shareApiLinkDefaultExpireDate(); |
|
284 | - |
|
285 | - /** |
|
286 | - * Is default expire date enforced |
|
287 | - *` |
|
288 | - * @return bool |
|
289 | - * @since 9.0.0 |
|
290 | - */ |
|
291 | - public function shareApiLinkDefaultExpireDateEnforced(); |
|
292 | - |
|
293 | - /** |
|
294 | - * Number of default expire days |
|
295 | - * |
|
296 | - * @return int |
|
297 | - * @since 9.0.0 |
|
298 | - */ |
|
299 | - public function shareApiLinkDefaultExpireDays(); |
|
300 | - |
|
301 | - /** |
|
302 | - * Allow public upload on link shares |
|
303 | - * |
|
304 | - * @return bool |
|
305 | - * @since 9.0.0 |
|
306 | - */ |
|
307 | - public function shareApiLinkAllowPublicUpload(); |
|
308 | - |
|
309 | - /** |
|
310 | - * check if user can only share with group members |
|
311 | - * @return bool |
|
312 | - * @since 9.0.0 |
|
313 | - */ |
|
314 | - public function shareWithGroupMembersOnly(); |
|
315 | - |
|
316 | - /** |
|
317 | - * Check if users can share with groups |
|
318 | - * @return bool |
|
319 | - * @since 9.0.1 |
|
320 | - */ |
|
321 | - public function allowGroupSharing(); |
|
322 | - |
|
323 | - /** |
|
324 | - * Check if sharing is disabled for the given user |
|
325 | - * |
|
326 | - * @param string $userId |
|
327 | - * @return bool |
|
328 | - * @since 9.0.0 |
|
329 | - */ |
|
330 | - public function sharingDisabledForUser($userId); |
|
331 | - |
|
332 | - /** |
|
333 | - * Check if outgoing server2server shares are allowed |
|
334 | - * @return bool |
|
335 | - * @since 9.0.0 |
|
336 | - */ |
|
337 | - public function outgoingServer2ServerSharesAllowed(); |
|
338 | - |
|
339 | - /** |
|
340 | - * Check if a given share provider exists |
|
341 | - * @param int $shareType |
|
342 | - * @return bool |
|
343 | - * @since 11.0.0 |
|
344 | - */ |
|
345 | - public function shareProviderExists($shareType); |
|
38 | + /** |
|
39 | + * Create a Share |
|
40 | + * |
|
41 | + * @param IShare $share |
|
42 | + * @return IShare The share object |
|
43 | + * @throws \Exception |
|
44 | + * @since 9.0.0 |
|
45 | + */ |
|
46 | + public function createShare(IShare $share); |
|
47 | + |
|
48 | + /** |
|
49 | + * Update a share. |
|
50 | + * The target of the share can't be changed this way: use moveShare |
|
51 | + * The share can't be removed this way (permission 0): use deleteShare |
|
52 | + * |
|
53 | + * @param IShare $share |
|
54 | + * @return IShare The share object |
|
55 | + * @throws \InvalidArgumentException |
|
56 | + * @since 9.0.0 |
|
57 | + */ |
|
58 | + public function updateShare(IShare $share); |
|
59 | + |
|
60 | + /** |
|
61 | + * Delete a share |
|
62 | + * |
|
63 | + * @param IShare $share |
|
64 | + * @throws ShareNotFound |
|
65 | + * @throws \InvalidArgumentException |
|
66 | + * @since 9.0.0 |
|
67 | + */ |
|
68 | + public function deleteShare(IShare $share); |
|
69 | + |
|
70 | + /** |
|
71 | + * Unshare a file as the recipient. |
|
72 | + * This can be different from a regular delete for example when one of |
|
73 | + * the users in a groups deletes that share. But the provider should |
|
74 | + * handle this. |
|
75 | + * |
|
76 | + * @param IShare $share |
|
77 | + * @param string $recipientId |
|
78 | + * @since 9.0.0 |
|
79 | + */ |
|
80 | + public function deleteFromSelf(IShare $share, $recipientId); |
|
81 | + |
|
82 | + /** |
|
83 | + * Move the share as a recipient of the share. |
|
84 | + * This is updating the share target. So where the recipient has the share mounted. |
|
85 | + * |
|
86 | + * @param IShare $share |
|
87 | + * @param string $recipientId |
|
88 | + * @return IShare |
|
89 | + * @throws \InvalidArgumentException If $share is a link share or the $recipient does not match |
|
90 | + * @since 9.0.0 |
|
91 | + */ |
|
92 | + public function moveShare(IShare $share, $recipientId); |
|
93 | + |
|
94 | + /** |
|
95 | + * Get all shares shared by (initiated) by the provided user in a folder. |
|
96 | + * |
|
97 | + * @param string $userId |
|
98 | + * @param Folder $node |
|
99 | + * @param bool $reshares |
|
100 | + * @return IShare[][] [$fileId => IShare[], ...] |
|
101 | + * @since 11.0.0 |
|
102 | + */ |
|
103 | + public function getSharesInFolder($userId, Folder $node, $reshares = false); |
|
104 | + |
|
105 | + /** |
|
106 | + * Get shares shared by (initiated) by the provided user. |
|
107 | + * |
|
108 | + * @param string $userId |
|
109 | + * @param int $shareType |
|
110 | + * @param Node|null $path |
|
111 | + * @param bool $reshares |
|
112 | + * @param int $limit The maximum number of returned results, -1 for all results |
|
113 | + * @param int $offset |
|
114 | + * @return IShare[] |
|
115 | + * @since 9.0.0 |
|
116 | + */ |
|
117 | + public function getSharesBy($userId, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0); |
|
118 | + |
|
119 | + /** |
|
120 | + * Get shares shared with $user. |
|
121 | + * Filter by $node if provided |
|
122 | + * |
|
123 | + * @param string $userId |
|
124 | + * @param int $shareType |
|
125 | + * @param Node|null $node |
|
126 | + * @param int $limit The maximum number of shares returned, -1 for all |
|
127 | + * @param int $offset |
|
128 | + * @return IShare[] |
|
129 | + * @since 9.0.0 |
|
130 | + */ |
|
131 | + public function getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0); |
|
132 | + |
|
133 | + /** |
|
134 | + * Retrieve a share by the share id. |
|
135 | + * If the recipient is set make sure to retrieve the file for that user. |
|
136 | + * This makes sure that if a user has moved/deleted a group share this |
|
137 | + * is reflected. |
|
138 | + * |
|
139 | + * @param string $id |
|
140 | + * @param string|null $recipient userID of the recipient |
|
141 | + * @return IShare |
|
142 | + * @throws ShareNotFound |
|
143 | + * @since 9.0.0 |
|
144 | + */ |
|
145 | + public function getShareById($id, $recipient = null); |
|
146 | + |
|
147 | + /** |
|
148 | + * Get the share by token possible with password |
|
149 | + * |
|
150 | + * @param string $token |
|
151 | + * @return IShare |
|
152 | + * @throws ShareNotFound |
|
153 | + * @since 9.0.0 |
|
154 | + */ |
|
155 | + public function getShareByToken($token); |
|
156 | + |
|
157 | + /** |
|
158 | + * Verify the password of a public share |
|
159 | + * |
|
160 | + * @param IShare $share |
|
161 | + * @param string $password |
|
162 | + * @return bool |
|
163 | + * @since 9.0.0 |
|
164 | + */ |
|
165 | + public function checkPassword(IShare $share, $password); |
|
166 | + |
|
167 | + /** |
|
168 | + * The user with UID is deleted. |
|
169 | + * All share providers have to cleanup the shares with this user as well |
|
170 | + * as shares owned by this user. |
|
171 | + * Shares only initiated by this user are fine. |
|
172 | + * |
|
173 | + * @param string $uid |
|
174 | + * @since 9.1.0 |
|
175 | + */ |
|
176 | + public function userDeleted($uid); |
|
177 | + |
|
178 | + /** |
|
179 | + * The group with $gid is deleted |
|
180 | + * We need to clear up all shares to this group |
|
181 | + * |
|
182 | + * @param string $gid |
|
183 | + * @since 9.1.0 |
|
184 | + */ |
|
185 | + public function groupDeleted($gid); |
|
186 | + |
|
187 | + /** |
|
188 | + * The user $uid is deleted from the group $gid |
|
189 | + * All user specific group shares have to be removed |
|
190 | + * |
|
191 | + * @param string $uid |
|
192 | + * @param string $gid |
|
193 | + * @since 9.1.0 |
|
194 | + */ |
|
195 | + public function userDeletedFromGroup($uid, $gid); |
|
196 | + |
|
197 | + /** |
|
198 | + * Get access list to a path. This means |
|
199 | + * all the users that can access a given path. |
|
200 | + * |
|
201 | + * Consider: |
|
202 | + * -root |
|
203 | + * |-folder1 (23) |
|
204 | + * |-folder2 (32) |
|
205 | + * |-fileA (42) |
|
206 | + * |
|
207 | + * fileA is shared with user1 and user1@server1 |
|
208 | + * folder2 is shared with group2 (user4 is a member of group2) |
|
209 | + * folder1 is shared with user2 (renamed to "folder (1)") and user2@server2 |
|
210 | + * |
|
211 | + * Then the access list to '/folder1/folder2/fileA' with $currentAccess is: |
|
212 | + * [ |
|
213 | + * users => [ |
|
214 | + * 'user1' => ['node_id' => 42, 'node_path' => '/fileA'], |
|
215 | + * 'user4' => ['node_id' => 32, 'node_path' => '/folder2'], |
|
216 | + * 'user2' => ['node_id' => 23, 'node_path' => '/folder (1)'], |
|
217 | + * ], |
|
218 | + * remote => [ |
|
219 | + * 'user1@server1' => ['node_id' => 42, 'token' => 'SeCr3t'], |
|
220 | + * 'user2@server2' => ['node_id' => 23, 'token' => 'FooBaR'], |
|
221 | + * ], |
|
222 | + * public => bool |
|
223 | + * mail => bool |
|
224 | + * ] |
|
225 | + * |
|
226 | + * The access list to '/folder1/folder2/fileA' **without** $currentAccess is: |
|
227 | + * [ |
|
228 | + * users => ['user1', 'user2', 'user4'], |
|
229 | + * remote => bool, |
|
230 | + * public => bool |
|
231 | + * mail => bool |
|
232 | + * ] |
|
233 | + * |
|
234 | + * This is required for encryption/activity |
|
235 | + * |
|
236 | + * @param \OCP\Files\Node $path |
|
237 | + * @param bool $recursive Should we check all parent folders as well |
|
238 | + * @param bool $currentAccess Should the user have currently access to the file |
|
239 | + * @return array |
|
240 | + * @since 12 |
|
241 | + */ |
|
242 | + public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false); |
|
243 | + |
|
244 | + /** |
|
245 | + * Instantiates a new share object. This is to be passed to |
|
246 | + * createShare. |
|
247 | + * |
|
248 | + * @return IShare |
|
249 | + * @since 9.0.0 |
|
250 | + */ |
|
251 | + public function newShare(); |
|
252 | + |
|
253 | + /** |
|
254 | + * Is the share API enabled |
|
255 | + * |
|
256 | + * @return bool |
|
257 | + * @since 9.0.0 |
|
258 | + */ |
|
259 | + public function shareApiEnabled(); |
|
260 | + |
|
261 | + /** |
|
262 | + * Is public link sharing enabled |
|
263 | + * |
|
264 | + * @return bool |
|
265 | + * @since 9.0.0 |
|
266 | + */ |
|
267 | + public function shareApiAllowLinks(); |
|
268 | + |
|
269 | + /** |
|
270 | + * Is password on public link requires |
|
271 | + * |
|
272 | + * @return bool |
|
273 | + * @since 9.0.0 |
|
274 | + */ |
|
275 | + public function shareApiLinkEnforcePassword(); |
|
276 | + |
|
277 | + /** |
|
278 | + * Is default expire date enabled |
|
279 | + * |
|
280 | + * @return bool |
|
281 | + * @since 9.0.0 |
|
282 | + */ |
|
283 | + public function shareApiLinkDefaultExpireDate(); |
|
284 | + |
|
285 | + /** |
|
286 | + * Is default expire date enforced |
|
287 | + *` |
|
288 | + * @return bool |
|
289 | + * @since 9.0.0 |
|
290 | + */ |
|
291 | + public function shareApiLinkDefaultExpireDateEnforced(); |
|
292 | + |
|
293 | + /** |
|
294 | + * Number of default expire days |
|
295 | + * |
|
296 | + * @return int |
|
297 | + * @since 9.0.0 |
|
298 | + */ |
|
299 | + public function shareApiLinkDefaultExpireDays(); |
|
300 | + |
|
301 | + /** |
|
302 | + * Allow public upload on link shares |
|
303 | + * |
|
304 | + * @return bool |
|
305 | + * @since 9.0.0 |
|
306 | + */ |
|
307 | + public function shareApiLinkAllowPublicUpload(); |
|
308 | + |
|
309 | + /** |
|
310 | + * check if user can only share with group members |
|
311 | + * @return bool |
|
312 | + * @since 9.0.0 |
|
313 | + */ |
|
314 | + public function shareWithGroupMembersOnly(); |
|
315 | + |
|
316 | + /** |
|
317 | + * Check if users can share with groups |
|
318 | + * @return bool |
|
319 | + * @since 9.0.1 |
|
320 | + */ |
|
321 | + public function allowGroupSharing(); |
|
322 | + |
|
323 | + /** |
|
324 | + * Check if sharing is disabled for the given user |
|
325 | + * |
|
326 | + * @param string $userId |
|
327 | + * @return bool |
|
328 | + * @since 9.0.0 |
|
329 | + */ |
|
330 | + public function sharingDisabledForUser($userId); |
|
331 | + |
|
332 | + /** |
|
333 | + * Check if outgoing server2server shares are allowed |
|
334 | + * @return bool |
|
335 | + * @since 9.0.0 |
|
336 | + */ |
|
337 | + public function outgoingServer2ServerSharesAllowed(); |
|
338 | + |
|
339 | + /** |
|
340 | + * Check if a given share provider exists |
|
341 | + * @param int $shareType |
|
342 | + * @return bool |
|
343 | + * @since 11.0.0 |
|
344 | + */ |
|
345 | + public function shareProviderExists($shareType); |
|
346 | 346 | |
347 | 347 | } |