Implement `MUTATE` permission on non-primitive fields
anasbarg opened this issue · 0 comments
anasbarg commented
Currently, we can do something like this:
model User {
@1 username: String @primary
@2 currentTodo: Todo?
@3 todos: [Todo]
}
model Todo {
@1 id: String @uuid @primary
@2 title: String
}
role User {
allow UPDATE self.currentTodo
allow MUTATE self.todos
}
The first rule allows us to update the reference of a Todo
row inside the self.currentTodo
field, but not the Todo
row itself. and the second rule allows us to push to and remove from self.todos
.
But if we can have a rule like:
...
allow MUTATE self.currentTodo
...
This will allow us to update the row of the reference stored in self.currentTodo
not just the reference.
Also, we have to think more about how to allow users to tell Pragma how to handle deep updates in terms of how many levels and which kinds of users can do which kinds of deep update.