Ben
04/12/2024, 4:33 AMdefinition myObject {
relation myRel: otherObj#rel1
permission myPerm = myRel->rel2
}
Where rel1 and rel2 are both permissions (I haven't tested with relations, but in my use case I need them to be permissions), it doesn't seem like myPerm ever evaluates to anything. Even doing an expand or using --explain on a check seems to show that the relations aren't being followed properly.
https://cdn.discordapp.com/attachments/844600078948630559/1228201342204379177/follow-permission-of-permission.yml?ex=662b2ea2&is=6618b9a2&hm=860a8a096fbc343d182116cd416d8b61a0d86b6a2f0ffe9fc6d128bce107dcca&Ben
04/12/2024, 6:27 AMcheckComputedUserset because it tries to typecheck the pair (targetRR.Namespace, targetRR.Relation) which in the case of a tuple to userset is rr.Namespace and cu.Relation respectively, which means that the check completely ignores rr.Relation which is populated in this case.vroldanbet
04/12/2024, 7:35 AMBen
04/12/2024, 8:28 AMif rr.Relation != Ellipsis and if so dispatch another check to expand the subject with relation into a list of singular subjects that can then be used in the continuation of the checkComputedUserset?Ben
04/12/2024, 10:09 AMlookupSubjects call which might get tricky as the ConcurrentChecker and ConcurrentLookupSubjects are two distinct struct and we therefore can't easily dispatch a lookupSubjects call as part of a check call without some restructuring first (unless we use the fact that the localDispatcher has both a checker field and a lookupSubjectsHandler field that we could use as a way for them to communicate?)Ben
04/12/2024, 10:21 AMJoey
04/12/2024, 10:39 AMJoey
04/12/2024, 10:39 AMBen
04/12/2024, 10:47 AMvroldanbet
04/12/2024, 10:58 AMJoey
04/12/2024, 11:00 AMJoey
04/12/2024, 11:00 AMJoey
04/12/2024, 11:00 AMJoey
04/12/2024, 11:00 AMJoey
04/12/2024, 11:01 AMvroldanbet
04/12/2024, 11:01 AMvroldanbet
04/12/2024, 11:01 AMJoey
04/12/2024, 11:02 AMJoey
04/12/2024, 11:02 AMJoey
04/12/2024, 11:03 AMvroldanbet
04/12/2024, 11:03 AMJoey
04/12/2024, 11:03 AMJoey
04/12/2024, 11:04 AMvroldanbet
04/12/2024, 11:04 AMJoey
04/12/2024, 11:04 AMvroldanbet
04/12/2024, 11:04 AMvroldanbet
04/12/2024, 11:04 AMJoey
04/12/2024, 11:04 AMBen
04/12/2024, 11:05 AMJoey
04/12/2024, 11:05 AMJoey
04/12/2024, 11:05 AMJoey
04/12/2024, 11:06 AMJoey
04/12/2024, 11:06 AMJoey
04/12/2024, 11:07 AMJoey
04/12/2024, 11:07 AMJoey
04/12/2024, 11:07 AMvroldanbet
04/12/2024, 11:09 AMJoey
04/12/2024, 11:09 AMJoey
04/12/2024, 11:09 AMJoey
04/12/2024, 11:09 AMvroldanbet
04/12/2024, 11:09 AMvroldanbet
04/12/2024, 11:09 AMJoey
04/12/2024, 11:09 AMvroldanbet
04/12/2024, 11:09 AMJoey
04/12/2024, 11:10 AMvroldanbet
04/12/2024, 11:10 AMvroldanbet
04/12/2024, 11:10 AMvroldanbet
04/12/2024, 11:10 AMvroldanbet
04/12/2024, 11:11 AMvroldanbet
04/12/2024, 11:11 AMJoey
04/12/2024, 11:11 AMJoey
04/12/2024, 11:11 AMBen
04/12/2024, 11:12 AMdefinition user {}
definition group {
relation direct_member: user
relation child: group
permission member = direct_member + child->member
permission descendants = child + child->descendants
}
definition group_intersection {
relation first: group
relation second: group
permission intersection = (first + first->descendants) & (second + second->descendants)
}
definition group_intersection_member {
relation base: group_intersection#intersection
permission member = base->member
}
definition document {
relation viewer: user | group#member | group_intersection_member#member
permission view = viewer
}vroldanbet
04/12/2024, 11:15 AMJoey
04/12/2024, 11:15 AMvroldanbet
04/12/2024, 11:15 AMJoey
04/12/2024, 11:16 AMJoey
04/12/2024, 11:16 AMvroldanbet
04/12/2024, 11:16 AMJoey
04/12/2024, 11:18 AMJoey
04/12/2024, 11:18 AMJoey
04/12/2024, 11:19 AMBen
04/12/2024, 11:30 AMvroldanbet
04/12/2024, 11:34 AMvroldanbet
04/12/2024, 11:40 AMBen
04/12/2024, 11:40 AMtuple_to_userset can't be a _this with an indirect ACL (subject with a subject relations in SpiceDB)Ben
04/12/2024, 11:40 AMvroldanbet
04/12/2024, 11:43 AMdefinition user {}
definition group {
relation direct_member: user
relation child: group
permission member = direct_member + child->member
permission descendants = child + child->descendants
}
definition group_intersection {
relation first: group
relation second: group
permission intersection = (first + first->descendants) & (second + second->descendants)
permission intersection_member = intersection->member
}
definition group_intersection_member {
relation base: group_intersection
permission member = base->intersection_member
}
definition document {
relation viewer: user | group#member | group_intersection_member#member
permission view = viewer
}Ben
04/12/2024, 11:45 AMdefinition someObject {
relation foo: first | second#whatever
permission bar = foo->somepermundersecond
}
I really don't feel like it should work. When using second#whatever for the foo relation, second is almost irrelevant here, and second#whatever should be considered an un-breakable entity. Even if for now we can't use -> to follow a permission from a subject relation for performance reasons, I'm struggling to see scenarios where it would make sense to follow the -> on the subject type when there is a subject relation presentBen
04/12/2024, 11:45 AMpermission intersection = (first + first->descendants) & (second + second->descendants)
permission intersection_member = intersection->member
That part fails when I try to write the schema as I can't use a permission on the left side of the arrowJoey
04/12/2024, 11:45 AMJoey
04/12/2024, 11:46 AMJoey
04/12/2024, 11:46 AMJoey
04/12/2024, 11:47 AMBen
04/12/2024, 11:47 AMJoey
04/12/2024, 11:47 AMJoey
04/12/2024, 11:47 AMJoey
04/12/2024, 11:48 AMJoey
04/12/2024, 11:48 AMJoey
04/12/2024, 11:50 AMJoey
04/12/2024, 11:50 AMBen
04/13/2024, 12:02 AMJoey
04/13/2024, 2:21 AMBen
04/13/2024, 2:39 AMfirst and second and instead only have one relation that I can take the intersection arrow on, but at the end of the day I will still need to follow another permission after that.
Let's say I have hierarchical groups that can have several parents. I have TX > Austin, TX > Dallas, CA > Sacramento, CA > LA, Capital > Austin, Capital > Sacramento, Regional > Dallas, Regional > LA. I want to give access to a document to members of groups that are both under TX and Capital (i.e. Austin in this example). It is important to note that this is not the same as the intersection of inherited members of TX and inherited members of Capital, as I could have a user that is both in Sacramento and Dallas and would therefore match that requirement which I do not want.Joey
04/16/2024, 9:19 PMJoey
04/16/2024, 9:20 PMJoey
04/16/2024, 9:20 PMtx#member and capital#member, right?Ben
04/16/2024, 9:25 PMSacramento and Dallas that would match tx#member & capital#member but not (tx#child & capital#child)->member which is what I wantJoey
04/16/2024, 9:25 PMJoey
04/16/2024, 9:25 PMJoey
04/16/2024, 9:25 PMJoey
04/16/2024, 9:26 PMBen
04/16/2024, 9:52 PMJoey
04/16/2024, 10:30 PMgroupJoey
04/16/2024, 10:31 PMJoey
04/16/2024, 10:51 PMwarehouse-tx and warehouse-ca and store-tx and `store-ca`; then you'd grant access to the document like:
document:forklistregs#viewer@group:warehouse-tx#memberJoey
04/16/2024, 10:52 PMJoey
04/16/2024, 10:52 PMBen
04/16/2024, 11:13 PMlocation1 (under dallas and warehouse), location2 (under houston and warehouse), location3 (under sacramento and store), location4 (under LA and warehouse); it would be quite a bit of overhead to have to manually maintain secondary groups such as warehouse-tx
- This would be for a SaaS model, so we don't directly control what intersections are going to be used for access, the users will, so we can't even pre-determine that we will need warehouse-tx for example
- In some of the use cases, one half of the intersection will be static while the other one will be dynamic (like you said, using some other relation on the document)Joey
04/16/2024, 11:14 PMJoey
04/16/2024, 11:14 PMBen
04/16/2024, 11:19 PMvroldanbet
04/17/2024, 7:27 AMsubject_type+subject_relation that is a TTU become denormalized. Wouldn0t that allow us to do chained TTUs over ComputedUsersets?vroldanbet
04/17/2024, 7:46 AMdefinition user {}
definition document {
relation owner: state#stores | state#warehouses
permission read = owner->member
}
definition state {
relation stores: store
relation warehouses: warehouse
}
definition warehouse {
relation members: user
}
definition store {
relation members: user
}Ben
04/17/2024, 11:44 PMBen
04/17/2024, 11:56 PMstate, warehouse and store, from our point of view they are all equivalent as a location for example (as a SaaS provider), those concepts are how one customer might be using it, however a different customer might have a different sub-division of their locations, so it's not something we can inherently bake into the schema unfortunatelyJoey
04/18/2024, 12:18 AMBen
04/18/2024, 10:33 PMJoey
04/18/2024, 10:48 PMJoey
04/18/2024, 10:49 PM