Fix types
parent: tbd commit: 7eb1974
1 | |
2 | |
3 | pub use *; |
4 | pub use *; |
5 | |
6 | pub use *; |
7 | |
8 | |
9 | pub use *; |
10 | |
11 | use ; |
12 | pub use *; |
13 | pub use *; |
14 | |
15 | |
16 | // Temp pub use to figure out what's important |
17 | |
18 | pub use Error; |
19 | pub use *; |
20 | pub use ; |
21 | pub use Instance; |
22 | pub use GiteratedObject; |
23 | pub use GiteratedOperation; |
24 | pub use User; |
25 | |
26 | |
27 | use ; |
28 | |
29 | use Debug; |
30 | use |
31 | , |
32 | |
33 | AuthenticationTokenRequest, Instance, RegisterAccountRequest, RepositoryCreateRequest, |
34 | , |
35 | , | GiteratedObject
36 | , | ObjectBackend
37 | , | GiteratedOperation
38 | , |
39 | , |
40 | , | User
41 | , |
42 | ; |
43 | |
44 | |
45 | |
46 | pub object_name: &'a str, |
47 | pub operation_name: &'a str, |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | Self |
54 | object_name: object_name, |
55 | operation_name: operation_name, |
56 | |
57 | |
58 | |
59 | |
60 | |
61 | |
62 | pub object_kind: &'a str, |
63 | pub value_kind: &'a str, |
64 | |
65 | |
66 | |
67 | |
68 | Self |
69 | object_kind: object_name, |
70 | value_kind: value_name, |
71 | |
72 | |
73 | |
74 | |
75 | |
76 | |
77 | pub object_kind: &'a str, |
78 | pub setting_name: &'a str, |
79 | |
80 | |
81 | |
82 | |
83 | Self |
84 | object_kind: object_name, |
85 | setting_name: name, |
86 | |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | type Error: ; |
93 | |
94 | async |
95 | object: &O, |
96 | operation: &D, |
97 | state: &StackOperationState, |
98 | ; |
99 | |
100 | |
101 | |
102 | |
103 | for StackOperationState |
104 | |
105 | type Error = Infallible; |
106 | |
107 | async |
108 | _object: &O, |
109 | _operation: &D, |
110 | state: &StackOperationState, |
111 | |
112 | Ok |
113 | |
114 | |
115 | |
116 | |
117 | |
118 | ; |
119 | |
120 | |
121 | |
122 | for AuthenticatedUser |
123 | |
124 | type Error = MissingValue; |
125 | |
126 | async |
127 | _object: &O, |
128 | _operation: &D, |
129 | state: &StackOperationState, |
130 | |
131 | state.user.clone .ok_or |
132 | |
133 | |
134 | |
135 | |
136 | |
137 | for AuthenticatedInstance |
138 | |
139 | type Error = MissingValue; |
140 | |
141 | async |
142 | _object: &O, |
143 | _operation: &D, |
144 | state: &StackOperationState, |
145 | |
146 | state.instance.clone .ok_or |
147 | |
148 | |
149 | |
150 | |
151 | |
152 | T: + Send + Sync, |
153 | O: GiteratedObject + Sync, |
154 | D: + Send + Sync, |
155 | > |
156 | |
157 | type Error = Infallible; |
158 | |
159 | async |
160 | object: &O, |
161 | operation: &D, |
162 | state: &StackOperationState, |
163 | |
164 | Ok |
165 | |
166 | |
167 | |
168 | |
169 | ; |
170 | |
171 | |
172 | ; |
173 | |
174 | |
175 | |
176 | type Error: ; |
177 | |
178 | async |
179 | &self, |
180 | authorize_for: &O, |
181 | state: &StackOperationState, |
182 | ; |
183 | |
184 | |
185 | |
186 | |
187 | type Error = Error; |
188 | |
189 | async |
190 | &self, |
191 | authorize_for: &O, |
192 | operation_state: &StackOperationState, |
193 | |
194 | Ok |
195 | .runtime |
196 | . |
197 | .await |
198 | .is_ok |
199 | |
200 | |
201 | |
202 | |
203 | |
204 | type Error = MissingValue; |
205 | |
206 | async |
207 | &self, |
208 | authorize_for: &User, |
209 | operation_state: &StackOperationState, |
210 | |
211 | let authenticated_user = operation_state.user.as_ref .ok_or?; |
212 | |
213 | Ok |
214 | |
215 | |
216 | |
217 | |
218 | |
219 | type Error = MissingValue; |
220 | |
221 | async |
222 | &self, |
223 | authorize_for: &User, |
224 | operation_state: &StackOperationState, |
225 | |
226 | let authenticated_user = operation_state.user.as_ref .ok_or?; |
227 | |
228 | Ok |
229 | |
230 | |
231 | |
232 | |
233 | |
234 | type Error = Error; |
235 | |
236 | async |
237 | &self, |
238 | authorize_for: &Repository, |
239 | operation_state: &StackOperationState, |
240 | |
241 | let authenticated_user = operation_state |
242 | .user |
243 | .as_ref |
244 | .ok_or_else?; |
245 | |
246 | let mut object = operation_state |
247 | .runtime |
248 | . |
249 | .await |
250 | .map_err?; |
251 | |
252 | let access_list = object |
253 | . |
254 | .await |
255 | .map_err?; |
256 | |
257 | if access_list |
258 | .0 |
259 | .iter |
260 | .any |
261 | |
262 | Ok |
263 | else |
264 | Ok |
265 | |
266 | |
267 | |
268 | |
269 | |
270 | |
271 | type Error = Error; |
272 | |
273 | async |
274 | &self, |
275 | authorize_for: &Repository, |
276 | operation_state: &StackOperationState, |
277 | |
278 | let authenticated_user = operation_state |
279 | .user |
280 | .as_ref |
281 | .ok_or_else?; |
282 | |
283 | let mut object = operation_state |
284 | .runtime |
285 | . |
286 | .await |
287 | .map_err?; |
288 | |
289 | let access_list = object |
290 | . |
291 | .await |
292 | .map_err?; |
293 | |
294 | if access_list |
295 | .0 |
296 | .iter |
297 | .any |
298 | |
299 | Ok |
300 | else |
301 | Ok |
302 | |
303 | |
304 | |
305 | |
306 | |
307 | |
308 | type Error = Infallible; |
309 | |
310 | async |
311 | &self, |
312 | authorize_for: &Instance, |
313 | state: &StackOperationState, |
314 | |
315 | if state.our_instance == *authorize_for |
316 | Ok |
317 | else |
318 | Ok |
319 | |
320 | |
321 | |
322 | |
323 | |
324 | |
325 | type Error = Infallible; |
326 | |
327 | async |
328 | &self, |
329 | authorize_for: &Instance, |
330 | state: &StackOperationState, |
331 | |
332 | if state.our_instance == *authorize_for |
333 | Ok |
334 | else |
335 | Ok |
336 | |
337 | |
338 | |
339 | |
340 | |
341 | |
342 | type Error = Infallible; |
343 | |
344 | async |
345 | &self, |
346 | authorize_for: &Instance, |
347 | state: &StackOperationState, |
348 | |
349 | if state.our_instance == *authorize_for |
350 | Ok |
351 | else |
352 | Ok |
353 | |
354 | |
355 | |
356 | |
357 | |
358 | |
359 | type Error = UnauthorizedError; |
360 | |
361 | async |
362 | object: &User, |
363 | operation: &A, |
364 | state: &StackOperationState, |
365 | |
366 | // TODO |
367 | let authenticated = from_state |
368 | .await |
369 | .map_err?; |
370 | |
371 | match operation.authorize .await |
372 | Ok => |
373 | assert!; |
374 | |
375 | Err => return Err, |
376 | ; |
377 | |
378 | Ok |
379 | |
380 | |
381 | |
382 | |
383 | |
384 | for AuthorizedInstance |
385 | |
386 | type Error = UnauthorizedError; |
387 | |
388 | async |
389 | object: &Instance, |
390 | operation: &A, |
391 | state: &StackOperationState, |
392 | |
393 | //TODO |
394 | let authenticated = from_state |
395 | .await |
396 | .map_err?; |
397 | |
398 | match operation.authorize .await |
399 | Ok => |
400 | assert!; |
401 | |
402 | Err => return Err, |
403 | ; |
404 | |
405 | Ok |
406 | |
407 | |
408 | |
409 | |
410 | |
411 | pub our_instance: Instance, |
412 | pub runtime: , |
413 | pub instance: , |
414 | pub user: , |
415 | |
416 | |
417 | |
418 | ; |
419 | |
420 | |
421 | |
422 | AuthenticatedInstance |
423 | |
424 | |
425 | |
426 | |
427 | type Target = Instance; |
428 | |
429 | |
430 | &self.0 |
431 | |
432 | |
433 | |
434 | |
435 | ; |
436 | |
437 | |
438 | |
439 | AuthenticatedUser |
440 | |
441 | |
442 | |
443 | |
444 | type Target = User; |
445 | |
446 | |
447 | &self.0 |
448 | |
449 | |
450 | |
451 | |
452 | |
453 | |
454 | ; |
455 | |
456 | |
457 | |
458 | O: GiteratedObject, |
459 | S: Setting + Serialize + DeserializeOwned, |
460 | |
461 | type Success = ; |
462 | |
463 | type Failure = ; |
464 | |
465 | |
466 | ; |
467 | |
468 | |
469 | |
470 | type Error = MissingValue; |
471 | |
472 | async |
473 | _required_parameters: &P, |
474 | _operation_state: &OS, |
475 | |
476 | todo! |
477 | |
478 | |
479 |