-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix generated membership for the development package when using indir…
…ect caveats Also adds a consistency test case for this scenario
- Loading branch information
1 parent
5d33a67
commit 5760751
Showing
3 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
internal/services/integrationtesting/testconfigs/caveatindirectarrow.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
schema: |- | ||
definition user {} | ||
caveat team_is_admin(admin_teams list<string>, self string) { | ||
self in admin_teams | ||
} | ||
definition team { | ||
relation admin: team with team_is_admin | ||
relation member: user | ||
permission view = admin->member | ||
} | ||
definition resource { | ||
relation team: team | ||
permission can_view = team->view | ||
} | ||
relationships: |- | ||
// team definition | ||
team:A#admin@team:A[team_is_admin:{"self":"A"}] | ||
team:B#admin@team:B[team_is_admin:{"self":"B"}] | ||
team:C#admin@team:C[team_is_admin:{"self":"C"}] | ||
// team members | ||
team:A#member@user:clara | ||
// resources | ||
resource:1#team@team:B | ||
resource:2#team@team:C | ||
resource:3#team@team:C | ||
resource:4#team@team:A | ||
resource:5#team@team:B | ||
resource:6#team@team:B | ||
resource:7#team@team:C | ||
assertions: | ||
assertTrue: | ||
- 'resource:4#can_view@user:clara with {"admin_teams": ["A"]}' | ||
assertCaveated: | ||
- resource:4#can_view@user:clara | ||
assertFalse: | ||
- 'resource:4#can_view@user:clara with {"admin_teams": ["B"]}' | ||
- 'resource:1#can_view@user:clara with {"admin_teams": ["B"]}' |