connor
06/23/2022, 6:34 PMJoey
06/23/2022, 6:36 PMJoey
06/23/2022, 6:36 PMJoey
06/23/2022, 6:37 PMJoey
06/23/2022, 6:37 PMconnor
06/23/2022, 6:48 PMJoey
06/23/2022, 8:02 PMJoey
06/23/2022, 8:02 PMJoey
06/23/2022, 8:02 PMJoey
06/23/2022, 8:02 PMdefinition user {}
definition token {}
definition resource {
relation viewer: user | token
permission view = viewer
}
Joey
06/23/2022, 8:02 PMtoken
if you have it as the subjectJoey
06/23/2022, 8:03 PMconnor
06/23/2022, 8:42 PMdefinition user {}
definition extra_permission {}
definition token {
relation user: user
relation extra_perm: extra_permission
}
definition post {
relation: token: token // so every time a token is created, it would need a link to all posts in the DB and same with if a post is created.
relation owner: user
permission view = owner + token->extra_perm
}
I think this implies that everytime a token is created we would have to enumerate all posts and create an entry in the DB linking them, same if a post is created, we have to enumerate all tokens and add a relation. Is that right?Joey
06/23/2022, 8:49 PMJoey
06/23/2022, 8:49 PMJoey
06/23/2022, 8:49 PMJoey
06/23/2022, 8:50 PMJoey
06/23/2022, 8:50 PMJoey
06/23/2022, 8:51 PMdefinition user {}
definition token {}
definition application {
relation view_posts: token
}
definition post {
relation application: application
relation viewer: user | token
permission view = viewer + application->view_posts
}
Joey
06/23/2022, 8:52 PMview_post
for the application, and each post is associated with zero or more applicationsconnor
06/23/2022, 10:01 PMdefinition user {}
definition view_post_perm {}
definition application {
relation view_post: view_post_perm
}
definition token {
relation user: user
relation application: application
}
definition post {
relation owner: user
relation viewer: token
permission view = owner + viewer->application->view_posts
}
This solution supposes that we have to create a link between every token, and every post. Not sure if that would be tenable because we have millions of users, each with tens of tokens and ~10billion posts.
Alternatively, I guess we could just not wrap this question all to one query and instead do two queries. Like this:
definition user {}
definition view_post_perm {}
definition application {
relation view_post: view_post_perm
permission view = view_post
}
definition token {
relation user: user
relation application: application
}
definition post {
relation owner: user
permission view = owner
}
Then ask
val userId = /read in
val appId = // read in
val check1 = post:123 view user:userId
val check2 = application:appId view
return check1 || check2
Seems like it defeats the purpose of zanzibar though.Joey
06/23/2022, 11:06 PMJoey
06/23/2022, 11:07 PMor
, not an and
, correct?Joey
06/23/2022, 11:08 PMJoey
06/23/2022, 11:08 PMconnor
06/24/2022, 12:07 AMJoey
06/24/2022, 12:16 AMconnor
06/24/2022, 1:23 AMJoey
06/24/2022, 1:29 AMdefinition post {
relation owner: user
relation viewer: token
permission view = owner + viewer->application->view_posts
}
why do you have the viewer as a token? aren't you checking to see if the token can view the post?connor
06/24/2022, 2:22 AMconnor
06/24/2022, 2:23 AMzed check post:123 view token:456
Joey
06/24/2022, 2:24 AMJoey
06/24/2022, 2:24 AMJoey
06/24/2022, 2:24 AMconnor
06/24/2022, 3:14 AMJoey
06/24/2022, 3:20 AMconnor
06/24/2022, 3:25 AMJoey
06/24/2022, 3:25 AMconnor
07/05/2022, 7:16 PMJoey
07/05/2022, 7:17 PMconnor
07/05/2022, 7:17 PMJoey
07/05/2022, 7:18 PMconnor
07/05/2022, 7:21 PMJoey
07/05/2022, 7:21 PMJoey
07/05/2022, 7:51 PMconnor
07/05/2022, 7:51 PMconnor
07/05/2022, 7:56 PMJoey
07/05/2022, 7:56 PMJoey
07/05/2022, 7:56 PMJoey
07/05/2022, 7:56 PMconnor
07/05/2022, 8:00 PMJoey
07/05/2022, 8:00 PMJoey
07/05/2022, 8:01 PM