You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support grouping user/object checks in store tests (#513)
* Add users list support in store check tests
* fix lint
* chore: fixed example
* refactor: consolidate user selection logic
* refactor: centralize getEffectiveUsers
* Validate check definitions and add tests
* Add support for multi-object checks
* fix: example was not working
* chore: added example for multiple objects
* chore: simplified error messages
* fix: fixed export command to not to write empty users/objects
* fix: linter issues
* chore: removed unneeded file and extra whitespaces in .fga.yaml
* chore: improved example
* chore: removed trailing whitespace
Copy file name to clipboardExpand all lines: README.md
+45-13Lines changed: 45 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -303,6 +303,22 @@ tests:
303
303
assertions:
304
304
member: true
305
305
moderator: false
306
+
# checks can also be defined for multiple users sharing the same expectation
307
+
- object: group:employees
308
+
users:
309
+
# checks can also target multiple objects with the same expectation
310
+
- objects:
311
+
- group:admins
312
+
- group:employees
313
+
user: user:1
314
+
assertions:
315
+
moderator: false
316
+
# either "user" or "users" may be provided, but not both
317
+
# either "object" or "objects" may be provided, but not both
318
+
- user:3
319
+
- user:4
320
+
assertions:
321
+
member: true
306
322
```
307
323
308
324
If using `output-file`, the response will be written to the specified file on disk. If the desired file already exists, you will be prompted to overwrite the file.
@@ -558,19 +574,35 @@ tests: # required
558
574
- name: test-1
559
575
description: testing that the model works # optional
560
576
# tuple_file: ./tuples.json # tuples that would apply per test
561
-
tuples:
562
-
- user: user:anne
563
-
relation: owner
564
-
object: folder:1
565
-
check: # a set of checks to run
566
-
- user: user:anne
567
-
object: folder:1
568
-
assertions:
569
-
# a set of expected results for each relation
570
-
can_view: true
571
-
can_write: true
572
-
can_share: false
573
-
list_objects: # a set of list objects to run
577
+
tuples:
578
+
- user: user:anne
579
+
relation: owner
580
+
object: folder:1
581
+
check: # a set of checks to run
582
+
- user: user:anne
583
+
object: folder:1
584
+
assertions:
585
+
# a set of expected results for each relation
586
+
can_view: true
587
+
can_write: true
588
+
can_share: false
589
+
# checks can group multiple users that share the same expected results
590
+
- object: folder:2
591
+
users:
592
+
- user:beth
593
+
- user:carl
594
+
assertions:
595
+
can_view: false
596
+
# checks can group multiple objects that share the same expected results
597
+
- objects:
598
+
- folder:1
599
+
- folder:2
600
+
user: user:beth
601
+
assertions:
602
+
can_write: false
603
+
# either "user" or "users" may be provided, but not both
604
+
# either "object" or "objects" may be provided, but not both
0 commit comments