Matt Polzin
09/07/2023, 3:08 AMMatt Polzin
09/07/2023, 3:10 AMdefinition user {}
definition project {
relation admin: user
relation member: user
relation approver: user
relation view_only: user
permission write = admin
permission view = write + view_only + member
permission approve = view - view_only
}
definition workspace {
relation project: project
relation project_viewers: project#view with is_public_workspace
relation workspace_admin: user
permission write = project->write + workspace_admin
permission view = write + project_viewers
permission approve = view & project->approve
}
caveat is_public_workspace(workspace_is_public bool) {
workspace_is_public
}Matt Polzin
09/07/2023, 3:14 AMworkspace for the same project (one caveat we and one not).
The crux of this is a need to both (a) represent a relationship that depends on whether the workspace is public and also (b) access some permissions from the related resource regardless of whether the workspace is public. Both relationships will be to the same project but you will note above that the caveated relationship is used in one way and the uncaveated relationship is used in another way and needs to register as permissive even when the caveated relationship does not.Joey
09/07/2023, 3:15 AMJoey
09/07/2023, 3:15 AMJoey
09/07/2023, 3:15 AMrelation project_viewers: user:*Joey
09/07/2023, 3:16 AMJoey
09/07/2023, 3:16 AMMatt Polzin
09/07/2023, 3:17 AMproject_viewers relationship when the workspace becomes public and then delete it when the workspace becomes private? The fact that it can flip between public and private was my initial reason for reaching for a caveat.Joey
09/07/2023, 3:19 AMJoey
09/07/2023, 3:19 AMJoey
09/07/2023, 3:19 AMJoey
09/07/2023, 3:19 AMMatt Polzin
09/07/2023, 3:35 AMrelation project_viewers: user:* with is_public_workspace
Maybe it isn’t idiomatic (which is worth noting), but would it also just be a bad idea on performance grounds unless it was needed?Joey
09/07/2023, 3:36 AMJoey
09/07/2023, 3:36 AMMatt Polzin
09/07/2023, 3:36 AMJoey
09/07/2023, 3:36 AMJoey
09/07/2023, 3:37 AM