https://authzed.com logo
#spicedb
Title
# spicedb
j

Joey

02/13/2022, 7:18 AM
another option would be to have a distinct
documentstate
definition:
Copy code
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 state