@@ -37,308 +37,308 @@ |
||
37 | 37 | */ |
38 | 38 | interface IShare { |
39 | 39 | |
40 | - /** |
|
41 | - * Set the internal id of the share |
|
42 | - * It is only allowed to set the internal id of a share once. |
|
43 | - * Attempts to override the internal id will result in an IllegalIDChangeException |
|
44 | - * |
|
45 | - * @param string $id |
|
46 | - * @return \OCP\Share\IShare |
|
47 | - * @throws IllegalIDChangeException |
|
48 | - * @throws \InvalidArgumentException |
|
49 | - * @since 9.1.0 |
|
50 | - */ |
|
51 | - public function setId($id); |
|
52 | - |
|
53 | - /** |
|
54 | - * Get the internal id of the share. |
|
55 | - * |
|
56 | - * @return string |
|
57 | - * @since 9.0.0 |
|
58 | - */ |
|
59 | - public function getId(); |
|
60 | - |
|
61 | - /** |
|
62 | - * Get the full share id. This is the <providerid>:<internalid>. |
|
63 | - * The full id is unique in the system. |
|
64 | - * |
|
65 | - * @return string |
|
66 | - * @since 9.0.0 |
|
67 | - * @throws \UnexpectedValueException If the fullId could not be constructed |
|
68 | - */ |
|
69 | - public function getFullId(); |
|
70 | - |
|
71 | - /** |
|
72 | - * Set the provider id of the share |
|
73 | - * It is only allowed to set the provider id of a share once. |
|
74 | - * Attempts to override the provider id will result in an IllegalIDChangeException |
|
75 | - * |
|
76 | - * @param string $id |
|
77 | - * @return \OCP\Share\IShare |
|
78 | - * @throws IllegalIDChangeException |
|
79 | - * @throws \InvalidArgumentException |
|
80 | - * @since 9.1.0 |
|
81 | - */ |
|
82 | - public function setProviderId($id); |
|
83 | - |
|
84 | - /** |
|
85 | - * Set the node of the file/folder that is shared |
|
86 | - * |
|
87 | - * @param Node $node |
|
88 | - * @return \OCP\Share\IShare The modified object |
|
89 | - * @since 9.0.0 |
|
90 | - */ |
|
91 | - public function setNode(Node $node); |
|
92 | - |
|
93 | - /** |
|
94 | - * Get the node of the file/folder that is shared |
|
95 | - * |
|
96 | - * @return File|Folder |
|
97 | - * @since 9.0.0 |
|
98 | - * @throws NotFoundException |
|
99 | - */ |
|
100 | - public function getNode(); |
|
101 | - |
|
102 | - /** |
|
103 | - * Set file id for lazy evaluation of the node |
|
104 | - * @param int $fileId |
|
105 | - * @return \OCP\Share\IShare The modified object |
|
106 | - * @since 9.0.0 |
|
107 | - */ |
|
108 | - public function setNodeId($fileId); |
|
109 | - |
|
110 | - /** |
|
111 | - * Get the fileid of the node of this share |
|
112 | - * @return int |
|
113 | - * @since 9.0.0 |
|
114 | - * @throws NotFoundException |
|
115 | - */ |
|
116 | - public function getNodeId(); |
|
117 | - |
|
118 | - /** |
|
119 | - * Set the type of node (file/folder) |
|
120 | - * |
|
121 | - * @param string $type |
|
122 | - * @return \OCP\Share\IShare The modified object |
|
123 | - * @since 9.0.0 |
|
124 | - */ |
|
125 | - public function setNodeType($type); |
|
126 | - |
|
127 | - /** |
|
128 | - * Get the type of node (file/folder) |
|
129 | - * |
|
130 | - * @return string |
|
131 | - * @since 9.0.0 |
|
132 | - * @throws NotFoundException |
|
133 | - */ |
|
134 | - public function getNodeType(); |
|
135 | - |
|
136 | - /** |
|
137 | - * Set the shareType |
|
138 | - * |
|
139 | - * @param int $shareType |
|
140 | - * @return \OCP\Share\IShare The modified object |
|
141 | - * @since 9.0.0 |
|
142 | - */ |
|
143 | - public function setShareType($shareType); |
|
144 | - |
|
145 | - /** |
|
146 | - * Get the shareType |
|
147 | - * |
|
148 | - * @return int |
|
149 | - * @since 9.0.0 |
|
150 | - */ |
|
151 | - public function getShareType(); |
|
152 | - |
|
153 | - /** |
|
154 | - * Set the receiver of this share. |
|
155 | - * |
|
156 | - * @param string $sharedWith |
|
157 | - * @return \OCP\Share\IShare The modified object |
|
158 | - * @since 9.0.0 |
|
159 | - */ |
|
160 | - public function setSharedWith($sharedWith); |
|
161 | - |
|
162 | - /** |
|
163 | - * Get the receiver of this share. |
|
164 | - * |
|
165 | - * @return string |
|
166 | - * @since 9.0.0 |
|
167 | - */ |
|
168 | - public function getSharedWith(); |
|
169 | - |
|
170 | - /** |
|
171 | - * Set the permissions. |
|
172 | - * See \OCP\Constants::PERMISSION_* |
|
173 | - * |
|
174 | - * @param int $permissions |
|
175 | - * @return \OCP\Share\IShare The modified object |
|
176 | - * @since 9.0.0 |
|
177 | - */ |
|
178 | - public function setPermissions($permissions); |
|
179 | - |
|
180 | - /** |
|
181 | - * Get the share permissions |
|
182 | - * See \OCP\Constants::PERMISSION_* |
|
183 | - * |
|
184 | - * @return int |
|
185 | - * @since 9.0.0 |
|
186 | - */ |
|
187 | - public function getPermissions(); |
|
188 | - |
|
189 | - /** |
|
190 | - * Set the expiration date |
|
191 | - * |
|
192 | - * @param null|\DateTime $expireDate |
|
193 | - * @return \OCP\Share\IShare The modified object |
|
194 | - * @since 9.0.0 |
|
195 | - */ |
|
196 | - public function setExpirationDate($expireDate); |
|
197 | - |
|
198 | - /** |
|
199 | - * Get the expiration date |
|
200 | - * |
|
201 | - * @return \DateTime |
|
202 | - * @since 9.0.0 |
|
203 | - */ |
|
204 | - public function getExpirationDate(); |
|
205 | - |
|
206 | - /** |
|
207 | - * Set the sharer of the path. |
|
208 | - * |
|
209 | - * @param string $sharedBy |
|
210 | - * @return \OCP\Share\IShare The modified object |
|
211 | - * @since 9.0.0 |
|
212 | - */ |
|
213 | - public function setSharedBy($sharedBy); |
|
214 | - |
|
215 | - /** |
|
216 | - * Get share sharer |
|
217 | - * |
|
218 | - * @return string |
|
219 | - * @since 9.0.0 |
|
220 | - */ |
|
221 | - public function getSharedBy(); |
|
222 | - |
|
223 | - /** |
|
224 | - * Set the original share owner (who owns the path that is shared) |
|
225 | - * |
|
226 | - * @param string $shareOwner |
|
227 | - * @return \OCP\Share\IShare The modified object |
|
228 | - * @since 9.0.0 |
|
229 | - */ |
|
230 | - public function setShareOwner($shareOwner); |
|
231 | - |
|
232 | - /** |
|
233 | - * Get the original share owner (who owns the path that is shared) |
|
234 | - * |
|
235 | - * @return string |
|
236 | - * @since 9.0.0 |
|
237 | - */ |
|
238 | - public function getShareOwner(); |
|
239 | - |
|
240 | - /** |
|
241 | - * Set the password for this share. |
|
242 | - * When the share is passed to the share manager to be created |
|
243 | - * or updated the password will be hashed. |
|
244 | - * |
|
245 | - * @param string $password |
|
246 | - * @return \OCP\Share\IShare The modified object |
|
247 | - * @since 9.0.0 |
|
248 | - */ |
|
249 | - public function setPassword($password); |
|
250 | - |
|
251 | - /** |
|
252 | - * Get the password of this share. |
|
253 | - * If this share is obtained via a shareprovider the password is |
|
254 | - * hashed. |
|
255 | - * |
|
256 | - * @return string |
|
257 | - * @since 9.0.0 |
|
258 | - */ |
|
259 | - public function getPassword(); |
|
260 | - |
|
261 | - /** |
|
262 | - * Set the public link token. |
|
263 | - * |
|
264 | - * @param string $token |
|
265 | - * @return \OCP\Share\IShare The modified object |
|
266 | - * @since 9.0.0 |
|
267 | - */ |
|
268 | - public function setToken($token); |
|
269 | - |
|
270 | - /** |
|
271 | - * Get the public link token. |
|
272 | - * |
|
273 | - * @return string |
|
274 | - * @since 9.0.0 |
|
275 | - */ |
|
276 | - public function getToken(); |
|
277 | - |
|
278 | - /** |
|
279 | - * Set the target path of this share relative to the recipients user folder. |
|
280 | - * |
|
281 | - * @param string $target |
|
282 | - * @return \OCP\Share\IShare The modified object |
|
283 | - * @since 9.0.0 |
|
284 | - */ |
|
285 | - public function setTarget($target); |
|
286 | - |
|
287 | - /** |
|
288 | - * Get the target path of this share relative to the recipients user folder. |
|
289 | - * |
|
290 | - * @return string |
|
291 | - * @since 9.0.0 |
|
292 | - */ |
|
293 | - public function getTarget(); |
|
294 | - |
|
295 | - /** |
|
296 | - * Set the time this share was created |
|
297 | - * |
|
298 | - * @param \DateTime $shareTime |
|
299 | - * @return \OCP\Share\IShare The modified object |
|
300 | - * @since 9.0.0 |
|
301 | - */ |
|
302 | - public function setShareTime(\DateTime $shareTime); |
|
303 | - |
|
304 | - /** |
|
305 | - * Get the timestamp this share was created |
|
306 | - * |
|
307 | - * @return \DateTime |
|
308 | - * @since 9.0.0 |
|
309 | - */ |
|
310 | - public function getShareTime(); |
|
311 | - |
|
312 | - /** |
|
313 | - * Set if the recipient is informed by mail about the share. |
|
314 | - * |
|
315 | - * @param bool $mailSend |
|
316 | - * @return \OCP\Share\IShare The modified object |
|
317 | - * @since 9.0.0 |
|
318 | - */ |
|
319 | - public function setMailSend($mailSend); |
|
320 | - |
|
321 | - /** |
|
322 | - * Get if the recipient informed by mail about the share. |
|
323 | - * |
|
324 | - * @return bool |
|
325 | - * @since 9.0.0 |
|
326 | - */ |
|
327 | - public function getMailSend(); |
|
328 | - |
|
329 | - /** |
|
330 | - * Set the cache entry for the shared node |
|
331 | - * |
|
332 | - * @param ICacheEntry $entry |
|
333 | - * @since 11.0.0 |
|
334 | - */ |
|
335 | - public function setNodeCacheEntry(ICacheEntry $entry); |
|
336 | - |
|
337 | - /** |
|
338 | - * Get the cache entry for the shared node |
|
339 | - * |
|
340 | - * @return null|ICacheEntry |
|
341 | - * @since 11.0.0 |
|
342 | - */ |
|
343 | - public function getNodeCacheEntry(); |
|
40 | + /** |
|
41 | + * Set the internal id of the share |
|
42 | + * It is only allowed to set the internal id of a share once. |
|
43 | + * Attempts to override the internal id will result in an IllegalIDChangeException |
|
44 | + * |
|
45 | + * @param string $id |
|
46 | + * @return \OCP\Share\IShare |
|
47 | + * @throws IllegalIDChangeException |
|
48 | + * @throws \InvalidArgumentException |
|
49 | + * @since 9.1.0 |
|
50 | + */ |
|
51 | + public function setId($id); |
|
52 | + |
|
53 | + /** |
|
54 | + * Get the internal id of the share. |
|
55 | + * |
|
56 | + * @return string |
|
57 | + * @since 9.0.0 |
|
58 | + */ |
|
59 | + public function getId(); |
|
60 | + |
|
61 | + /** |
|
62 | + * Get the full share id. This is the <providerid>:<internalid>. |
|
63 | + * The full id is unique in the system. |
|
64 | + * |
|
65 | + * @return string |
|
66 | + * @since 9.0.0 |
|
67 | + * @throws \UnexpectedValueException If the fullId could not be constructed |
|
68 | + */ |
|
69 | + public function getFullId(); |
|
70 | + |
|
71 | + /** |
|
72 | + * Set the provider id of the share |
|
73 | + * It is only allowed to set the provider id of a share once. |
|
74 | + * Attempts to override the provider id will result in an IllegalIDChangeException |
|
75 | + * |
|
76 | + * @param string $id |
|
77 | + * @return \OCP\Share\IShare |
|
78 | + * @throws IllegalIDChangeException |
|
79 | + * @throws \InvalidArgumentException |
|
80 | + * @since 9.1.0 |
|
81 | + */ |
|
82 | + public function setProviderId($id); |
|
83 | + |
|
84 | + /** |
|
85 | + * Set the node of the file/folder that is shared |
|
86 | + * |
|
87 | + * @param Node $node |
|
88 | + * @return \OCP\Share\IShare The modified object |
|
89 | + * @since 9.0.0 |
|
90 | + */ |
|
91 | + public function setNode(Node $node); |
|
92 | + |
|
93 | + /** |
|
94 | + * Get the node of the file/folder that is shared |
|
95 | + * |
|
96 | + * @return File|Folder |
|
97 | + * @since 9.0.0 |
|
98 | + * @throws NotFoundException |
|
99 | + */ |
|
100 | + public function getNode(); |
|
101 | + |
|
102 | + /** |
|
103 | + * Set file id for lazy evaluation of the node |
|
104 | + * @param int $fileId |
|
105 | + * @return \OCP\Share\IShare The modified object |
|
106 | + * @since 9.0.0 |
|
107 | + */ |
|
108 | + public function setNodeId($fileId); |
|
109 | + |
|
110 | + /** |
|
111 | + * Get the fileid of the node of this share |
|
112 | + * @return int |
|
113 | + * @since 9.0.0 |
|
114 | + * @throws NotFoundException |
|
115 | + */ |
|
116 | + public function getNodeId(); |
|
117 | + |
|
118 | + /** |
|
119 | + * Set the type of node (file/folder) |
|
120 | + * |
|
121 | + * @param string $type |
|
122 | + * @return \OCP\Share\IShare The modified object |
|
123 | + * @since 9.0.0 |
|
124 | + */ |
|
125 | + public function setNodeType($type); |
|
126 | + |
|
127 | + /** |
|
128 | + * Get the type of node (file/folder) |
|
129 | + * |
|
130 | + * @return string |
|
131 | + * @since 9.0.0 |
|
132 | + * @throws NotFoundException |
|
133 | + */ |
|
134 | + public function getNodeType(); |
|
135 | + |
|
136 | + /** |
|
137 | + * Set the shareType |
|
138 | + * |
|
139 | + * @param int $shareType |
|
140 | + * @return \OCP\Share\IShare The modified object |
|
141 | + * @since 9.0.0 |
|
142 | + */ |
|
143 | + public function setShareType($shareType); |
|
144 | + |
|
145 | + /** |
|
146 | + * Get the shareType |
|
147 | + * |
|
148 | + * @return int |
|
149 | + * @since 9.0.0 |
|
150 | + */ |
|
151 | + public function getShareType(); |
|
152 | + |
|
153 | + /** |
|
154 | + * Set the receiver of this share. |
|
155 | + * |
|
156 | + * @param string $sharedWith |
|
157 | + * @return \OCP\Share\IShare The modified object |
|
158 | + * @since 9.0.0 |
|
159 | + */ |
|
160 | + public function setSharedWith($sharedWith); |
|
161 | + |
|
162 | + /** |
|
163 | + * Get the receiver of this share. |
|
164 | + * |
|
165 | + * @return string |
|
166 | + * @since 9.0.0 |
|
167 | + */ |
|
168 | + public function getSharedWith(); |
|
169 | + |
|
170 | + /** |
|
171 | + * Set the permissions. |
|
172 | + * See \OCP\Constants::PERMISSION_* |
|
173 | + * |
|
174 | + * @param int $permissions |
|
175 | + * @return \OCP\Share\IShare The modified object |
|
176 | + * @since 9.0.0 |
|
177 | + */ |
|
178 | + public function setPermissions($permissions); |
|
179 | + |
|
180 | + /** |
|
181 | + * Get the share permissions |
|
182 | + * See \OCP\Constants::PERMISSION_* |
|
183 | + * |
|
184 | + * @return int |
|
185 | + * @since 9.0.0 |
|
186 | + */ |
|
187 | + public function getPermissions(); |
|
188 | + |
|
189 | + /** |
|
190 | + * Set the expiration date |
|
191 | + * |
|
192 | + * @param null|\DateTime $expireDate |
|
193 | + * @return \OCP\Share\IShare The modified object |
|
194 | + * @since 9.0.0 |
|
195 | + */ |
|
196 | + public function setExpirationDate($expireDate); |
|
197 | + |
|
198 | + /** |
|
199 | + * Get the expiration date |
|
200 | + * |
|
201 | + * @return \DateTime |
|
202 | + * @since 9.0.0 |
|
203 | + */ |
|
204 | + public function getExpirationDate(); |
|
205 | + |
|
206 | + /** |
|
207 | + * Set the sharer of the path. |
|
208 | + * |
|
209 | + * @param string $sharedBy |
|
210 | + * @return \OCP\Share\IShare The modified object |
|
211 | + * @since 9.0.0 |
|
212 | + */ |
|
213 | + public function setSharedBy($sharedBy); |
|
214 | + |
|
215 | + /** |
|
216 | + * Get share sharer |
|
217 | + * |
|
218 | + * @return string |
|
219 | + * @since 9.0.0 |
|
220 | + */ |
|
221 | + public function getSharedBy(); |
|
222 | + |
|
223 | + /** |
|
224 | + * Set the original share owner (who owns the path that is shared) |
|
225 | + * |
|
226 | + * @param string $shareOwner |
|
227 | + * @return \OCP\Share\IShare The modified object |
|
228 | + * @since 9.0.0 |
|
229 | + */ |
|
230 | + public function setShareOwner($shareOwner); |
|
231 | + |
|
232 | + /** |
|
233 | + * Get the original share owner (who owns the path that is shared) |
|
234 | + * |
|
235 | + * @return string |
|
236 | + * @since 9.0.0 |
|
237 | + */ |
|
238 | + public function getShareOwner(); |
|
239 | + |
|
240 | + /** |
|
241 | + * Set the password for this share. |
|
242 | + * When the share is passed to the share manager to be created |
|
243 | + * or updated the password will be hashed. |
|
244 | + * |
|
245 | + * @param string $password |
|
246 | + * @return \OCP\Share\IShare The modified object |
|
247 | + * @since 9.0.0 |
|
248 | + */ |
|
249 | + public function setPassword($password); |
|
250 | + |
|
251 | + /** |
|
252 | + * Get the password of this share. |
|
253 | + * If this share is obtained via a shareprovider the password is |
|
254 | + * hashed. |
|
255 | + * |
|
256 | + * @return string |
|
257 | + * @since 9.0.0 |
|
258 | + */ |
|
259 | + public function getPassword(); |
|
260 | + |
|
261 | + /** |
|
262 | + * Set the public link token. |
|
263 | + * |
|
264 | + * @param string $token |
|
265 | + * @return \OCP\Share\IShare The modified object |
|
266 | + * @since 9.0.0 |
|
267 | + */ |
|
268 | + public function setToken($token); |
|
269 | + |
|
270 | + /** |
|
271 | + * Get the public link token. |
|
272 | + * |
|
273 | + * @return string |
|
274 | + * @since 9.0.0 |
|
275 | + */ |
|
276 | + public function getToken(); |
|
277 | + |
|
278 | + /** |
|
279 | + * Set the target path of this share relative to the recipients user folder. |
|
280 | + * |
|
281 | + * @param string $target |
|
282 | + * @return \OCP\Share\IShare The modified object |
|
283 | + * @since 9.0.0 |
|
284 | + */ |
|
285 | + public function setTarget($target); |
|
286 | + |
|
287 | + /** |
|
288 | + * Get the target path of this share relative to the recipients user folder. |
|
289 | + * |
|
290 | + * @return string |
|
291 | + * @since 9.0.0 |
|
292 | + */ |
|
293 | + public function getTarget(); |
|
294 | + |
|
295 | + /** |
|
296 | + * Set the time this share was created |
|
297 | + * |
|
298 | + * @param \DateTime $shareTime |
|
299 | + * @return \OCP\Share\IShare The modified object |
|
300 | + * @since 9.0.0 |
|
301 | + */ |
|
302 | + public function setShareTime(\DateTime $shareTime); |
|
303 | + |
|
304 | + /** |
|
305 | + * Get the timestamp this share was created |
|
306 | + * |
|
307 | + * @return \DateTime |
|
308 | + * @since 9.0.0 |
|
309 | + */ |
|
310 | + public function getShareTime(); |
|
311 | + |
|
312 | + /** |
|
313 | + * Set if the recipient is informed by mail about the share. |
|
314 | + * |
|
315 | + * @param bool $mailSend |
|
316 | + * @return \OCP\Share\IShare The modified object |
|
317 | + * @since 9.0.0 |
|
318 | + */ |
|
319 | + public function setMailSend($mailSend); |
|
320 | + |
|
321 | + /** |
|
322 | + * Get if the recipient informed by mail about the share. |
|
323 | + * |
|
324 | + * @return bool |
|
325 | + * @since 9.0.0 |
|
326 | + */ |
|
327 | + public function getMailSend(); |
|
328 | + |
|
329 | + /** |
|
330 | + * Set the cache entry for the shared node |
|
331 | + * |
|
332 | + * @param ICacheEntry $entry |
|
333 | + * @since 11.0.0 |
|
334 | + */ |
|
335 | + public function setNodeCacheEntry(ICacheEntry $entry); |
|
336 | + |
|
337 | + /** |
|
338 | + * Get the cache entry for the shared node |
|
339 | + * |
|
340 | + * @return null|ICacheEntry |
|
341 | + * @since 11.0.0 |
|
342 | + */ |
|
343 | + public function getNodeCacheEntry(); |
|
344 | 344 | } |
@@ -32,84 +32,84 @@ |
||
32 | 32 | */ |
33 | 33 | class Capabilities implements ICapability { |
34 | 34 | |
35 | - /** @var IConfig */ |
|
36 | - private $config; |
|
37 | - |
|
38 | - /** @var IAppManager */ |
|
39 | - private $appManager; |
|
40 | - |
|
41 | - public function __construct(IConfig $config, IAppManager $appManager) { |
|
42 | - $this->config = $config; |
|
43 | - $this->appManager = $appManager; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * Return this classes capabilities |
|
48 | - * |
|
49 | - * @return array |
|
50 | - */ |
|
51 | - public function getCapabilities() { |
|
52 | - $res = []; |
|
53 | - |
|
54 | - if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
55 | - $res['api_enabled'] = false; |
|
56 | - $res['public'] = ['enabled' => false]; |
|
57 | - $res['user'] = ['send_mail' => false]; |
|
58 | - $res['resharing'] = false; |
|
59 | - } else { |
|
60 | - $res['api_enabled'] = true; |
|
61 | - |
|
62 | - $public = []; |
|
63 | - $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; |
|
64 | - if ($public['enabled']) { |
|
65 | - $public['password'] = []; |
|
66 | - $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'); |
|
67 | - |
|
68 | - $public['expire_date'] = []; |
|
69 | - $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
70 | - if ($public['expire_date']['enabled']) { |
|
71 | - $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
72 | - $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
73 | - } |
|
74 | - |
|
75 | - $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes'; |
|
76 | - $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; |
|
77 | - $public['upload_files_drop'] = $public['upload']; |
|
78 | - } |
|
79 | - $res["public"] = $public; |
|
80 | - |
|
81 | - $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; |
|
82 | - |
|
83 | - $res['user']['send_mail'] = false; |
|
84 | - $res['user']['expire_date']['enabled'] = true; |
|
85 | - |
|
86 | - // deprecated in favour of 'group', but we need to keep it for now |
|
87 | - // in order to stay compatible with older clients |
|
88 | - $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
89 | - |
|
90 | - $res['group'] = []; |
|
91 | - $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
92 | - $res['group']['expire_date']['enabled'] = true; |
|
93 | - } |
|
94 | - |
|
95 | - //Federated sharing |
|
96 | - $res['federation'] = [ |
|
97 | - 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes', |
|
98 | - 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes', |
|
99 | - 'expire_date' => ['enabled' => true] |
|
100 | - ]; |
|
101 | - |
|
102 | - if ($this->appManager->isEnabledForUser('sharebymail')) { |
|
103 | - $res['mailshare'] = [ |
|
104 | - 'enabled' => true, |
|
105 | - 'upload_files_drop' => ['enabled' => true], |
|
106 | - 'password' => ['enabled' => true], |
|
107 | - 'expire_date' => ['enabled' => true] |
|
108 | - ]; |
|
109 | - } |
|
110 | - |
|
111 | - return [ |
|
112 | - 'files_sharing' => $res, |
|
113 | - ]; |
|
114 | - } |
|
35 | + /** @var IConfig */ |
|
36 | + private $config; |
|
37 | + |
|
38 | + /** @var IAppManager */ |
|
39 | + private $appManager; |
|
40 | + |
|
41 | + public function __construct(IConfig $config, IAppManager $appManager) { |
|
42 | + $this->config = $config; |
|
43 | + $this->appManager = $appManager; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * Return this classes capabilities |
|
48 | + * |
|
49 | + * @return array |
|
50 | + */ |
|
51 | + public function getCapabilities() { |
|
52 | + $res = []; |
|
53 | + |
|
54 | + if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') { |
|
55 | + $res['api_enabled'] = false; |
|
56 | + $res['public'] = ['enabled' => false]; |
|
57 | + $res['user'] = ['send_mail' => false]; |
|
58 | + $res['resharing'] = false; |
|
59 | + } else { |
|
60 | + $res['api_enabled'] = true; |
|
61 | + |
|
62 | + $public = []; |
|
63 | + $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes'; |
|
64 | + if ($public['enabled']) { |
|
65 | + $public['password'] = []; |
|
66 | + $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes'); |
|
67 | + |
|
68 | + $public['expire_date'] = []; |
|
69 | + $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes'; |
|
70 | + if ($public['expire_date']['enabled']) { |
|
71 | + $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
72 | + $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes'; |
|
73 | + } |
|
74 | + |
|
75 | + $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes'; |
|
76 | + $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes'; |
|
77 | + $public['upload_files_drop'] = $public['upload']; |
|
78 | + } |
|
79 | + $res["public"] = $public; |
|
80 | + |
|
81 | + $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes'; |
|
82 | + |
|
83 | + $res['user']['send_mail'] = false; |
|
84 | + $res['user']['expire_date']['enabled'] = true; |
|
85 | + |
|
86 | + // deprecated in favour of 'group', but we need to keep it for now |
|
87 | + // in order to stay compatible with older clients |
|
88 | + $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
89 | + |
|
90 | + $res['group'] = []; |
|
91 | + $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes'; |
|
92 | + $res['group']['expire_date']['enabled'] = true; |
|
93 | + } |
|
94 | + |
|
95 | + //Federated sharing |
|
96 | + $res['federation'] = [ |
|
97 | + 'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes', |
|
98 | + 'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes', |
|
99 | + 'expire_date' => ['enabled' => true] |
|
100 | + ]; |
|
101 | + |
|
102 | + if ($this->appManager->isEnabledForUser('sharebymail')) { |
|
103 | + $res['mailshare'] = [ |
|
104 | + 'enabled' => true, |
|
105 | + 'upload_files_drop' => ['enabled' => true], |
|
106 | + 'password' => ['enabled' => true], |
|
107 | + 'expire_date' => ['enabled' => true] |
|
108 | + ]; |
|
109 | + } |
|
110 | + |
|
111 | + return [ |
|
112 | + 'files_sharing' => $res, |
|
113 | + ]; |
|
114 | + } |
|
115 | 115 | } |