Chris Morin
08/08/2024, 12:14 AMChris Morin
08/08/2024, 12:22 AMdefinition user {}
definition team {
relation normal: user
relation admin: user
permission update = admin
permission member = admin + normal
}
Option 1: wildcards
definition part {
relation owning_team: team
relation whitelist: user | user:*
permission write = (owning_team->member & whitelist) + owning_team->admin
}
When the part is created, the whitelist would need to be created with the wildcard for all users by default. This is a drawback. When we want to use the whitelist to restrict a part, we remove that wildcard relationship and add the whitelisted users as whitelist relationships.
Option 2: denormalize relationships and caveat
definition part {
relation owning_team_admin: team
relation owning_team_unrestricted: team with is_unrestricted
relation whitelist: user
permission write = (owning_team_unrestricted->member & whitelist) + owning_team_admin->admin
}
The drawback here is that we need to denormalize the data have duplicate relationships.
Is there a better way of doing this?Chris Morin
08/08/2024, 12:23 AMyetitwo
08/08/2024, 12:40 AMyetitwo
08/08/2024, 12:41 AMyetitwo
08/08/2024, 12:44 AMChris Morin
08/08/2024, 12:46 AMyetitwo
08/08/2024, 12:48 AM