sashayakovtseva_46690
11/13/2023, 7:21 PMsashayakovtseva_46690
11/13/2023, 7:21 PMdefinition user {}
definition folder {
relation owner: user
}
definition file {
relation folder: folder
permission access = folder->owner
}
sashayakovtseva_46690
11/13/2023, 7:21 PMJoey
11/13/2023, 7:24 PMJoey
11/13/2023, 7:25 PMJoey
11/13/2023, 7:25 PMJoey
11/13/2023, 7:25 PMJoey
11/13/2023, 7:26 PMsashayakovtseva_46690
11/13/2023, 7:45 PMdefinition user {}
definition playlist {
relation owner: user
relation viewer: user
permission view_content = viewer + owner
}
definition video {
relation playlist: playlist
permission access = playlist->view_content
}
I want to group entities under a parent and manage per entity access via group permissions.Joey
11/13/2023, 7:49 PMJoey
11/13/2023, 7:49 PMJoey
11/13/2023, 7:50 PMJoey
11/13/2023, 7:50 PMJoey
11/13/2023, 7:50 PMsashayakovtseva_46690
11/13/2023, 7:54 PMsashayakovtseva_46690
11/13/2023, 7:55 PMJoey
11/13/2023, 8:01 PMsashayakovtseva_46690
11/14/2023, 7:42 AMsashayakovtseva_46690
11/14/2023, 7:59 AMsashayakovtseva_46690
11/14/2023, 11:14 AMdefinition user {}
definition company {
relation accountant: user
relation member: user
permission view_money_stats = accountant
}
definition campaign {
relation company: company
relation webmaster: user
permission setup_traffic = webmaster
permission view_money_stats = setup_traffic + company->view_money_stats
}
definition offer {
relation campaign: campaign
permission view_money_stats = campaign->view_money_stats
}
sashayakovtseva_46690
11/14/2023, 11:14 AMcompany:myCoolAds#accountant@user:alice
. I store zedToken1 alongside myCoolAds
2) write campaign:asiaCampaign#company@company:myCoolAds
. zedToken2 alongside myCoolAds (link to parent) and asiaCampaign (resource creation)
3) write campaign:asiaCampaign#webmaster@user:bob
. zedToken3 alongside asiaCampaign
4) write offer:spicedbMeetup#camplaign@campaign:asiaCampaign
. zedToken4 alongside spicedbMeetup and asiaCampaign
5) check offer:spicedbMeetup#view_money_stats@user:bob
at zedToken4 from spicedbMeetup. has permissionship
6) write campaign:asiaCampaign#webmaster@user:jack
. zedToken5 alongside asiaCampaign
7) delete campaign:asiaCampaign#webmaster@user:bob
. zedToken6 alongside asiaCampaign
8) write company:myCoolAds#accountant@user:kate
. zedToken7 alongside myCoolAds
9) now I want to check offer:spicedbMeetup#view_money_stats@user:bob
again. But zedToken stored alongside spicedbMeetup has not changed, so I use zedToken4 and bob still has permissionship.
When working with money related resources/permissions it is essential to perform checks such that they do not give false positives or negatives.
One could argue, that fully_consistent is the key here, but in high-load system that would result in underlying storage overload.
ZedTokens seem to be a viable solution for achieveing both performance and correctness, but they don't seem to work with nested schema as in the example above.
I chose to store zedTokens according to https://authzed.com/docs/reference/zedtokens-and-zookies#how-do-i-use-them.
So my question is: am I storing zedTokens in a wrong place? Or is SpiceDB not suitable for read-after-write protection?Joey
11/14/2023, 2:09 PMJoey
11/14/2023, 2:10 PMJoey
11/14/2023, 2:10 PMJoey
11/14/2023, 2:10 PMJoey
11/14/2023, 2:12 PMJoey
11/14/2023, 2:12 PMJoey
11/14/2023, 2:13 PMJoey
11/14/2023, 2:13 PMsashayakovtseva_46690
11/14/2023, 3:16 PMJoey
11/14/2023, 3:24 PMJoey
11/14/2023, 3:25 PMJoey
11/14/2023, 3:25 PMsashayakovtseva_46690
11/14/2023, 3:26 PMJoey
11/14/2023, 3:44 PMJoey
11/14/2023, 3:45 PMJoey
11/14/2023, 3:45 PMGMG-Christine
11/14/2023, 4:47 PMJoey
11/14/2023, 5:14 PMJoey
11/14/2023, 5:16 PMGMG-Christine
11/14/2023, 9:27 PM