yetitwo
03/14/2025, 1:47 PMdefinition resource {
relation is_public: resource
relation viewer: user
permission view = viewer + is_public
}
and then you write resource:1#is_public@resource_1
to enable that "flag"matko031
03/17/2025, 10:01 PMresource:1#is_public@resource_1
is set, how exactly does viewer + is_public
evaluate to all users since viewer and is_public are relationships with two different types?yetitwo
03/17/2025, 10:03 PMJoey
03/17/2025, 10:05 PMJoey
03/17/2025, 10:06 PMrelation viewer: user | user:*
matko031
03/17/2025, 10:28 PMdefinition user {}
definition resource {
relation is_public: resource
relation viewer: user
permission view = viewer + is_public
}
---
resource:resource1#is_public@resource:resource1
resource:resource1#viewer@user:user1
resource:resource2#viewer@user:user1
Here I have two resources and two users. user1 is viewer of both resources and user2 is viewer of non. resource1 has is_public flag set. But in case of both resources, only user1 (the viewer) can view it, so I don't quite understand what is is_public flag changing exactly?
https://cdn.discordapp.com/attachments/1350103155039277067/1351321424224059422/image.png?ex=67d9f3a5&is=67d8a225&hm=f050ff3370ff8a54d730ea7184dbc0f1f42a9085dc87f0a3ed5872566bf66b51&Joey
03/17/2025, 10:30 PMJoey
03/17/2025, 10:30 PMJoey
03/17/2025, 10:30 PMyetitwo
03/17/2025, 10:33 PMyetitwo
03/17/2025, 10:33 PMmatko031
03/17/2025, 10:36 PMdefinition archive {
relation owner: team // archive has one owner that is a team
relation administrators: user // archive has multiple adminstrators who are users
/* Who can view the archive? */
// setting this relationship for certain archive would enable any user to view it
relation viewers: user:*
// administrators and owner team members can always view the archive
permission view = administrators + owner->members + viewers
/* Who can edit the archive? */
// setting this relationship for certain archive would enable either any user to view it or members of a specific team to view it
// Application logic should ensure this is only ever set for the owner team
relation editors : user:* | team#members
// administrators can always edit the archive
permission edit = administrators + editors
// Only administrators can delete the archive
permission delete = administrators
}
I am a bit stuck at the
// Application logic should ensure this is only ever set for the owner team
relation editors : user:* | team#members
and am wondering if there's a way to not have to enforce this in application logic but create a relation that would work something like this: relation editors: user:* | owner#members
so that there is no possibility of some non-owner team to get the edit permissionJoey
03/17/2025, 10:44 PMJoey
03/17/2025, 10:44 PMJoey
03/17/2025, 10:44 PMJoey
03/17/2025, 10:44 PMmatko031
03/17/2025, 10:48 PMpointing to another relation or permission
?Joey
03/18/2025, 11:30 AMdefinition resource {
relation some_flag: resource#someotherrelation
relation viewer: user
relation someotherrelation: user
permission view = viewer + some_flag
}
Joey
03/18/2025, 11:30 AMsomeotherrelation
IF it is enabledmatko031
03/19/2025, 10:12 PMdefinition team {
relation member: user // team has multiple members who are users
}
definition user {}
definition archive {
relation owner: team // archive's owner is a team
permission owner_member = owner->member
relation archive_administrator: user // archive's administrator is an user
/* Who can edit the archive? */
// Setting this relationship for certain archive would enable the members of owner team to edit it
relation owner_members_can_edit: archive#owner_member
// administrators can always edit the archive
permission edit = archive_administrator + owner_members_can_edit
}
---
archive:archive1#owner@team:team1
archive:archive1#owner_members_can_edit@archive:archive1#owner_member -> now members of team1 can edit archive1
matko031
03/19/2025, 10:12 PMdefinition team {
relation member: user // team has multiple members who are users
}
definition user {}
definition archive {
relation owner: team // archive's owner is a team
relation archive_administrator: user // archive's administrator is an user
/* Who can edit the archive? */
relation owner_members_can_edit: archive#owner
// administrators can always edit the archive
permission edit = archive_administrator + owner_members_can_edit->member
}
---
// user2 is member of team1
team:team1#member@user:user2
// team1 owns archive 1
archive:archive1#owner@team:team1
// use1 is administrator of archive1
archive:archive1#archive_administrator@user:user1
// archive 1 can be edited by owner team members
archive:archive1#owner_members_can_edit@archive:archive1#owner
matko031
03/19/2025, 10:13 PMowner_members_can_edit->member
doesn't even show up in check watches
https://cdn.discordapp.com/attachments/1350103155039277067/1352042377237237772/image.png?ex=67dc9316&is=67db4196&hm=f1a4ab02e502a1f3813643042cdd7e207449e085f1804051bec057df4d59f6ac&Joey
03/19/2025, 10:16 PMJoey
03/19/2025, 10:17 PMowner_members_can_edit->member
is pointing to member
on the archiveJoey
03/19/2025, 10:17 PMJoey
03/19/2025, 10:17 PMmatko031
03/19/2025, 10:23 PM