Hi Team,
I need some help in designing the schema for my usecase.
explanation:
There are two team owner jake and chandler and both of them having their own team.
Both are them sharing a same policy tagged to their userpermission.
Both while tagging the team I want them to communicate to their respective team by reading the common policy.
If we can write a separate policy for each of them it will work. but i need to have a common policy since they share other common parameters like "channel" in this example.
I was looking through caveats. But I couldn't able to figure it out. can some one help me solve this?
playground link:
https://play.authzed.com/s/gBm-crEV8TS6/schema
Schema:
definition user {}
definition channel{
relation member : user
}
definition team {
relation owner : user
relation member : user
}
definition policy {
relation team: team
relation channel: channel
permission communicate = channel-> member + team ->member
}
definition userpermission {
relation granted : policy
permission communicate = granted -> communicate
}
relations:
channel:channel_A#member@user:chandler
channel:channel_A#member@user:jake
team:team_chandler#owner@user:pheobe
team:team_chandler#member@user:rachel
team:team_chandler#member@user:monica
team:team_chandler#member@user:ross
team:team_chandler#member@user:joey
team:team_jake#owner@user:jake
team:team_jake#member@user:boyle
team:team_jake#member@user:amy
team:team_jake#member@user:rosa
team:team_jake#member@user:gina
team:team_jake#member@user:terry
team:team_jake#member@user:captain_holt
policy:common_policy#channel@channel:channel_A
// i cannot give team_jake or team_chandler since the other owner of the team will be able to talk to other team. which is not expected
policy:common_policy#team@team:<
>
userpermission:permission_chandler#granted@policy:common_policy
userpermission:permission_jake#granted@policy:common_policy