@@ -38,203 +38,203 @@ |
||
38 | 38 | */ |
39 | 39 | interface IShareProvider { |
40 | 40 | |
41 | - /** |
|
42 | - * Return the identifier of this provider. |
|
43 | - * |
|
44 | - * @return string Containing only [a-zA-Z0-9] |
|
45 | - * @since 9.0.0 |
|
46 | - */ |
|
47 | - public function identifier(); |
|
48 | - |
|
49 | - /** |
|
50 | - * Create a share |
|
51 | - * |
|
52 | - * @param \OCP\Share\IShare $share |
|
53 | - * @return \OCP\Share\IShare The share object |
|
54 | - * @since 9.0.0 |
|
55 | - */ |
|
56 | - public function create(\OCP\Share\IShare $share); |
|
57 | - |
|
58 | - /** |
|
59 | - * Update a share |
|
60 | - * |
|
61 | - * @param \OCP\Share\IShare $share |
|
62 | - * @return \OCP\Share\IShare The share object |
|
63 | - * @since 9.0.0 |
|
64 | - */ |
|
65 | - public function update(\OCP\Share\IShare $share); |
|
66 | - |
|
67 | - /** |
|
68 | - * Accept a share. |
|
69 | - * |
|
70 | - * @param IShare $share |
|
71 | - * @param string $recipient |
|
72 | - * @return IShare The share object |
|
73 | - * @since 17.0.0 |
|
74 | - */ |
|
41 | + /** |
|
42 | + * Return the identifier of this provider. |
|
43 | + * |
|
44 | + * @return string Containing only [a-zA-Z0-9] |
|
45 | + * @since 9.0.0 |
|
46 | + */ |
|
47 | + public function identifier(); |
|
48 | + |
|
49 | + /** |
|
50 | + * Create a share |
|
51 | + * |
|
52 | + * @param \OCP\Share\IShare $share |
|
53 | + * @return \OCP\Share\IShare The share object |
|
54 | + * @since 9.0.0 |
|
55 | + */ |
|
56 | + public function create(\OCP\Share\IShare $share); |
|
57 | + |
|
58 | + /** |
|
59 | + * Update a share |
|
60 | + * |
|
61 | + * @param \OCP\Share\IShare $share |
|
62 | + * @return \OCP\Share\IShare The share object |
|
63 | + * @since 9.0.0 |
|
64 | + */ |
|
65 | + public function update(\OCP\Share\IShare $share); |
|
66 | + |
|
67 | + /** |
|
68 | + * Accept a share. |
|
69 | + * |
|
70 | + * @param IShare $share |
|
71 | + * @param string $recipient |
|
72 | + * @return IShare The share object |
|
73 | + * @since 17.0.0 |
|
74 | + */ |
|
75 | 75 | // public function acceptShare(IShare $share, string $recipient): IShare; |
76 | 76 | |
77 | - /** |
|
78 | - * Delete a share |
|
79 | - * |
|
80 | - * @param \OCP\Share\IShare $share |
|
81 | - * @since 9.0.0 |
|
82 | - */ |
|
83 | - public function delete(\OCP\Share\IShare $share); |
|
84 | - |
|
85 | - /** |
|
86 | - * Unshare a file from self as recipient. |
|
87 | - * This may require special handling. If a user unshares a group |
|
88 | - * share from their self then the original group share should still exist. |
|
89 | - * |
|
90 | - * @param \OCP\Share\IShare $share |
|
91 | - * @param string $recipient UserId of the recipient |
|
92 | - * @since 9.0.0 |
|
93 | - */ |
|
94 | - public function deleteFromSelf(\OCP\Share\IShare $share, $recipient); |
|
95 | - |
|
96 | - /** |
|
97 | - * Restore a share for a given recipient. The implementation could be provider independant. |
|
98 | - * |
|
99 | - * @param IShare $share |
|
100 | - * @param string $recipient |
|
101 | - * @return IShare The restored share object |
|
102 | - * |
|
103 | - * @since 14.0.0 |
|
104 | - * @throws GenericShareException In case the share could not be restored |
|
105 | - */ |
|
106 | - public function restore(IShare $share, string $recipient): IShare; |
|
107 | - |
|
108 | - /** |
|
109 | - * Move a share as a recipient. |
|
110 | - * This is updating the share target. Thus the mount point of the recipient. |
|
111 | - * This may require special handling. If a user moves a group share |
|
112 | - * the target should only be changed for them. |
|
113 | - * |
|
114 | - * @param \OCP\Share\IShare $share |
|
115 | - * @param string $recipient userId of recipient |
|
116 | - * @return \OCP\Share\IShare |
|
117 | - * @since 9.0.0 |
|
118 | - */ |
|
119 | - public function move(\OCP\Share\IShare $share, $recipient); |
|
120 | - |
|
121 | - /** |
|
122 | - * Get all shares by the given user in a folder |
|
123 | - * |
|
124 | - * @param string $userId |
|
125 | - * @param Folder $node |
|
126 | - * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator |
|
127 | - * @return \OCP\Share\IShare[][] |
|
128 | - * @since 11.0.0 |
|
129 | - */ |
|
130 | - public function getSharesInFolder($userId, Folder $node, $reshares); |
|
131 | - |
|
132 | - /** |
|
133 | - * Get all shares by the given user |
|
134 | - * |
|
135 | - * @param string $userId |
|
136 | - * @param int $shareType |
|
137 | - * @param Node|null $node |
|
138 | - * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator |
|
139 | - * @param int $limit The maximum number of shares to be returned, -1 for all shares |
|
140 | - * @param int $offset |
|
141 | - * @return \OCP\Share\IShare[] |
|
142 | - * @since 9.0.0 |
|
143 | - */ |
|
144 | - public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset); |
|
145 | - |
|
146 | - /** |
|
147 | - * Get share by id |
|
148 | - * |
|
149 | - * @param int $id |
|
150 | - * @param string|null $recipientId |
|
151 | - * @return \OCP\Share\IShare |
|
152 | - * @throws ShareNotFound |
|
153 | - * @since 9.0.0 |
|
154 | - */ |
|
155 | - public function getShareById($id, $recipientId = null); |
|
156 | - |
|
157 | - /** |
|
158 | - * Get shares for a given path |
|
159 | - * |
|
160 | - * @param Node $path |
|
161 | - * @return \OCP\Share\IShare[] |
|
162 | - * @since 9.0.0 |
|
163 | - */ |
|
164 | - public function getSharesByPath(Node $path); |
|
165 | - |
|
166 | - /** |
|
167 | - * Get shared with the given user |
|
168 | - * |
|
169 | - * @param string $userId get shares where this user is the recipient |
|
170 | - * @param int $shareType |
|
171 | - * @param Node|null $node |
|
172 | - * @param int $limit The max number of entries returned, -1 for all |
|
173 | - * @param int $offset |
|
174 | - * @return \OCP\Share\IShare[] |
|
175 | - * @since 9.0.0 |
|
176 | - */ |
|
177 | - public function getSharedWith($userId, $shareType, $node, $limit, $offset); |
|
178 | - |
|
179 | - /** |
|
180 | - * Get a share by token |
|
181 | - * |
|
182 | - * @param string $token |
|
183 | - * @return \OCP\Share\IShare |
|
184 | - * @throws ShareNotFound |
|
185 | - * @since 9.0.0 |
|
186 | - */ |
|
187 | - public function getShareByToken($token); |
|
188 | - |
|
189 | - /** |
|
190 | - * A user is deleted from the system |
|
191 | - * So clean up the relevant shares. |
|
192 | - * |
|
193 | - * @param string $uid |
|
194 | - * @param int $shareType |
|
195 | - * @since 9.1.0 |
|
196 | - */ |
|
197 | - public function userDeleted($uid, $shareType); |
|
198 | - |
|
199 | - /** |
|
200 | - * A group is deleted from the system. |
|
201 | - * We have to clean up all shares to this group. |
|
202 | - * Providers not handling group shares should just return |
|
203 | - * |
|
204 | - * @param string $gid |
|
205 | - * @since 9.1.0 |
|
206 | - */ |
|
207 | - public function groupDeleted($gid); |
|
208 | - |
|
209 | - /** |
|
210 | - * A user is deleted from a group |
|
211 | - * We have to clean up all the related user specific group shares |
|
212 | - * Providers not handling group shares should just return |
|
213 | - * |
|
214 | - * @param string $uid |
|
215 | - * @param string $gid |
|
216 | - * @since 9.1.0 |
|
217 | - */ |
|
218 | - public function userDeletedFromGroup($uid, $gid); |
|
219 | - |
|
220 | - /** |
|
221 | - * Get the access list to the array of provided nodes. |
|
222 | - * |
|
223 | - * @see IManager::getAccessList() for sample docs |
|
224 | - * |
|
225 | - * @param Node[] $nodes The list of nodes to get access for |
|
226 | - * @param bool $currentAccess If current access is required (like for removed shares that might get revived later) |
|
227 | - * @return array |
|
228 | - * @since 12 |
|
229 | - */ |
|
230 | - public function getAccessList($nodes, $currentAccess); |
|
231 | - |
|
232 | - /** |
|
233 | - * Get all the shares in this provider returned as iterable to reduce memory |
|
234 | - * overhead |
|
235 | - * |
|
236 | - * @return iterable |
|
237 | - * @since 18.0.0 |
|
238 | - */ |
|
239 | - public function getAllShares(): iterable; |
|
77 | + /** |
|
78 | + * Delete a share |
|
79 | + * |
|
80 | + * @param \OCP\Share\IShare $share |
|
81 | + * @since 9.0.0 |
|
82 | + */ |
|
83 | + public function delete(\OCP\Share\IShare $share); |
|
84 | + |
|
85 | + /** |
|
86 | + * Unshare a file from self as recipient. |
|
87 | + * This may require special handling. If a user unshares a group |
|
88 | + * share from their self then the original group share should still exist. |
|
89 | + * |
|
90 | + * @param \OCP\Share\IShare $share |
|
91 | + * @param string $recipient UserId of the recipient |
|
92 | + * @since 9.0.0 |
|
93 | + */ |
|
94 | + public function deleteFromSelf(\OCP\Share\IShare $share, $recipient); |
|
95 | + |
|
96 | + /** |
|
97 | + * Restore a share for a given recipient. The implementation could be provider independant. |
|
98 | + * |
|
99 | + * @param IShare $share |
|
100 | + * @param string $recipient |
|
101 | + * @return IShare The restored share object |
|
102 | + * |
|
103 | + * @since 14.0.0 |
|
104 | + * @throws GenericShareException In case the share could not be restored |
|
105 | + */ |
|
106 | + public function restore(IShare $share, string $recipient): IShare; |
|
107 | + |
|
108 | + /** |
|
109 | + * Move a share as a recipient. |
|
110 | + * This is updating the share target. Thus the mount point of the recipient. |
|
111 | + * This may require special handling. If a user moves a group share |
|
112 | + * the target should only be changed for them. |
|
113 | + * |
|
114 | + * @param \OCP\Share\IShare $share |
|
115 | + * @param string $recipient userId of recipient |
|
116 | + * @return \OCP\Share\IShare |
|
117 | + * @since 9.0.0 |
|
118 | + */ |
|
119 | + public function move(\OCP\Share\IShare $share, $recipient); |
|
120 | + |
|
121 | + /** |
|
122 | + * Get all shares by the given user in a folder |
|
123 | + * |
|
124 | + * @param string $userId |
|
125 | + * @param Folder $node |
|
126 | + * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator |
|
127 | + * @return \OCP\Share\IShare[][] |
|
128 | + * @since 11.0.0 |
|
129 | + */ |
|
130 | + public function getSharesInFolder($userId, Folder $node, $reshares); |
|
131 | + |
|
132 | + /** |
|
133 | + * Get all shares by the given user |
|
134 | + * |
|
135 | + * @param string $userId |
|
136 | + * @param int $shareType |
|
137 | + * @param Node|null $node |
|
138 | + * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator |
|
139 | + * @param int $limit The maximum number of shares to be returned, -1 for all shares |
|
140 | + * @param int $offset |
|
141 | + * @return \OCP\Share\IShare[] |
|
142 | + * @since 9.0.0 |
|
143 | + */ |
|
144 | + public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset); |
|
145 | + |
|
146 | + /** |
|
147 | + * Get share by id |
|
148 | + * |
|
149 | + * @param int $id |
|
150 | + * @param string|null $recipientId |
|
151 | + * @return \OCP\Share\IShare |
|
152 | + * @throws ShareNotFound |
|
153 | + * @since 9.0.0 |
|
154 | + */ |
|
155 | + public function getShareById($id, $recipientId = null); |
|
156 | + |
|
157 | + /** |
|
158 | + * Get shares for a given path |
|
159 | + * |
|
160 | + * @param Node $path |
|
161 | + * @return \OCP\Share\IShare[] |
|
162 | + * @since 9.0.0 |
|
163 | + */ |
|
164 | + public function getSharesByPath(Node $path); |
|
165 | + |
|
166 | + /** |
|
167 | + * Get shared with the given user |
|
168 | + * |
|
169 | + * @param string $userId get shares where this user is the recipient |
|
170 | + * @param int $shareType |
|
171 | + * @param Node|null $node |
|
172 | + * @param int $limit The max number of entries returned, -1 for all |
|
173 | + * @param int $offset |
|
174 | + * @return \OCP\Share\IShare[] |
|
175 | + * @since 9.0.0 |
|
176 | + */ |
|
177 | + public function getSharedWith($userId, $shareType, $node, $limit, $offset); |
|
178 | + |
|
179 | + /** |
|
180 | + * Get a share by token |
|
181 | + * |
|
182 | + * @param string $token |
|
183 | + * @return \OCP\Share\IShare |
|
184 | + * @throws ShareNotFound |
|
185 | + * @since 9.0.0 |
|
186 | + */ |
|
187 | + public function getShareByToken($token); |
|
188 | + |
|
189 | + /** |
|
190 | + * A user is deleted from the system |
|
191 | + * So clean up the relevant shares. |
|
192 | + * |
|
193 | + * @param string $uid |
|
194 | + * @param int $shareType |
|
195 | + * @since 9.1.0 |
|
196 | + */ |
|
197 | + public function userDeleted($uid, $shareType); |
|
198 | + |
|
199 | + /** |
|
200 | + * A group is deleted from the system. |
|
201 | + * We have to clean up all shares to this group. |
|
202 | + * Providers not handling group shares should just return |
|
203 | + * |
|
204 | + * @param string $gid |
|
205 | + * @since 9.1.0 |
|
206 | + */ |
|
207 | + public function groupDeleted($gid); |
|
208 | + |
|
209 | + /** |
|
210 | + * A user is deleted from a group |
|
211 | + * We have to clean up all the related user specific group shares |
|
212 | + * Providers not handling group shares should just return |
|
213 | + * |
|
214 | + * @param string $uid |
|
215 | + * @param string $gid |
|
216 | + * @since 9.1.0 |
|
217 | + */ |
|
218 | + public function userDeletedFromGroup($uid, $gid); |
|
219 | + |
|
220 | + /** |
|
221 | + * Get the access list to the array of provided nodes. |
|
222 | + * |
|
223 | + * @see IManager::getAccessList() for sample docs |
|
224 | + * |
|
225 | + * @param Node[] $nodes The list of nodes to get access for |
|
226 | + * @param bool $currentAccess If current access is required (like for removed shares that might get revived later) |
|
227 | + * @return array |
|
228 | + * @since 12 |
|
229 | + */ |
|
230 | + public function getAccessList($nodes, $currentAccess); |
|
231 | + |
|
232 | + /** |
|
233 | + * Get all the shares in this provider returned as iterable to reduce memory |
|
234 | + * overhead |
|
235 | + * |
|
236 | + * @return iterable |
|
237 | + * @since 18.0.0 |
|
238 | + */ |
|
239 | + public function getAllShares(): iterable; |
|
240 | 240 | } |