|
19 | 19 | - patch: Modifications of define |
20 | 20 | */}} |
21 | 21 | - version: |
22 | | - major: 8 |
| 22 | + major: 9 |
23 | 23 | minor: 0 |
24 | 24 | patch: 0 |
25 | 25 | authorizationModel: | |
@@ -295,22 +295,44 @@ spec: |
295 | 295 | define committee: [committee] |
296 | 296 | define project: [project] |
297 | 297 | define writer: writer from project or writer from committee |
| 298 | + # auditor has access to participants, viewer does not |
298 | 299 | define auditor: writer or auditor from project or auditor from committee |
299 | | - define viewer: [user:*] or auditor |
| 300 | + define participant: [user] |
| 301 | + define viewer: [user:*] or auditor or participant |
| 302 | + define vote_for_participant_result_access: [vote] # set this relation to "self" to enable access |
| 303 | + # results_viewer is not for viewing the actual related vote_response objects, |
| 304 | + # but rather for an aggregate summary which can be made optionally public |
| 305 | + define results_viewer: [user:*] or auditor or participant from vote_for_participant_result_access |
300 | 306 |
|
301 | | - type individual_vote |
| 307 | + type vote_response |
302 | 308 | relations |
303 | 309 | define vote: [vote] |
304 | | - define auditor: auditor from vote |
305 | | - define writer: [user] # Only individuals can update their own vote |
306 | | - define viewer: [user] |
| 310 | + # owner is the user who cast this response |
| 311 | + define owner: [user] |
| 312 | + # we don't need to create a "writer" relation that is defined as just "owner": |
| 313 | + # we just use the "owner" relation in our access checks! |
| 314 | + define auditor: owner or auditor from vote |
307 | 315 |
|
308 | | - # Vote results are not updated directly, but are instead an aggregation |
309 | | - # of individual votes. This is done because the results of votes can themselves |
310 | | - # be public or not, independently from the vote itself. |
311 | | - type vote_results |
| 316 | + type survey |
312 | 317 | relations |
313 | | - define vote: [vote] |
314 | | - define auditor: auditor from vote |
315 | | - define viewer: [user:*] or auditor |
| 318 | + define committee: [committee] |
| 319 | + define project: [project] |
| 320 | + define writer: writer from project or writer from committee |
| 321 | + # auditor has access to participants, viewer does not |
| 322 | + define auditor: writer or auditor from project or auditor from committee |
| 323 | + define participant: [user] |
| 324 | + define viewer: [user:*] or auditor or participant |
| 325 | + define survey_for_participant_result_access: [survey] # set this relation to "self" to enable access |
| 326 | + # results_viewer is not for viewing the actual related survey_response objects, |
| 327 | + # but rather for an aggregate summary which can be made optionally public |
| 328 | + define results_viewer: [user:*] or auditor or participant from survey_for_participant_result_access |
| 329 | +
|
| 330 | + type survey_response |
| 331 | + relations |
| 332 | + define survey: [survey] |
| 333 | + # owner is the user who cast this response |
| 334 | + define owner: [user] |
| 335 | + # we don't need to create a "writer" relation that is defined as just "owner": |
| 336 | + # we just use the "owner" relation in our access checks! |
| 337 | + define auditor: owner or auditor from survey |
316 | 338 | {{- end }} |
0 commit comments