phroggyy
02/10/2022, 2:50 PMecordell
02/10/2022, 2:55 PMphroggyy
02/10/2022, 2:59 PMmember
. So you shouldn't be only account_manager
, but rather both member and AM. That way we can look at only member, and also give the possibility of associating a person with a team/org unit without associating them with a role. Though I'm still uncertain if that makes sense, or if we should rather just have the distinct roles and let member
be a permission that combines allJake
02/10/2022, 3:01 PMJake
02/10/2022, 3:02 PMmember
as a permission you can do something like this:
definition business_unit {
relation direct_member: user
relation account_manager: user
relation sales_director: user
permission member = direct_member + account_manager + sales_director
phroggyy
02/10/2022, 4:13 PMaccount_manager
across all `business_unit`s? So effectively the same as
for unit in units:
unit->account_manager
or similarphroggyy
02/10/2022, 4:14 PMJake
02/10/2022, 4:14 PMDisciplineCpt
02/11/2022, 8:51 PMJoey
02/11/2022, 9:03 PMJoey
02/11/2022, 9:03 PMJake
02/11/2022, 9:03 PMDisciplineCpt
02/11/2022, 9:43 PMuser
02/11/2022, 9:45 PMjava
RelationshipUpdate.newBuilder().setOperation(RelationshipUpdate.Operation.OPERATION_TOUCH).setRelationship(...)
DisciplineCpt
02/11/2022, 9:51 PMbalchu
02/13/2022, 6:52 AMACQUIRED
, VALIDATED
and PROCESSED
Some users can only read documents with ACQUIRED state while others can see documents with VALIDATED
state.
Is this something that is a common case?
ThanksJoey
02/13/2022, 7:13 AMJoey
02/13/2022, 7:13 AMJoey
02/13/2022, 7:13 AMJoey
02/13/2022, 7:16 AMviewer_state
to the associated relation in the same document, based on its state:
definition user {}
definition document {
relation acquired_viewer: user
relation validated_viewer: user
relation processed_viewer: user
relation viewer_state: document#acquired_viewer | document#validated_viewer | document#processed_viewer
permission view = viewer_state
}
Joey
02/13/2022, 7:18 AMdocumentstate
definition:
definition user {}
definition documentstate {
relation viewer: user
permission view = viewer
}
definition document {
relation state: documentstate
permission view = state->view
}
in this design, you have three resources for each document, representing the three states, with associated users. When you want to change the state of the document, you simply change the relationship between a document
and its state
, and it gets the associated users that can view in that stateJoey
02/13/2022, 7:18 AMJoey
02/13/2022, 7:18 AM{statename}_viewer
for each stateJoey
02/13/2022, 7:22 AMbalchu
02/13/2022, 7:59 AMmixedCase
02/15/2022, 2:48 AMJoey
02/15/2022, 2:53 AMJoey
02/15/2022, 2:53 AMmixedCase
02/15/2022, 3:05 AMSELECT * FROM item WHERE id = ?
5 times, or I can call SELECT * FROM item where id IN (?, ?, ?, ?, ?)
and get a response with far less network overhead. Ideally, I'd like to do the equivalent to the latter with SpiceDB. If firing 5 goroutines and calling it a day is the best it can do, that's something I can deal with for now, but if I can avoid it that'd be sweet.Joey
02/15/2022, 3:07 AMIN
is because you want to ensure a single connection is used, and the data is loaded efficiently. With SpiceDB, on the other hand, making the calls in a goroutine will be close to ideal because (a) you're making them via gRPC, which will multiplex the calls across a single http/2 connection (b) SpiceDB is designed to process those requests in parallel and (c) the caching and single dispatch systems should reuse as many of the subproblem results as is reasonably possible