I have a list of objects which look like this when they are created:
{
owner: "<user uid>",
pending: true,
origin: { ... },
destination: { ... },
fare: { ... },
driver: {
user: null,
...
}
}
I need to write rules such that:
- Anyone can insert a new object
- Anyone can read objects
- Anyone can claim an object, by setting
pending: false
, anddriver.user: <their uid>
. They should only have write permission onpending
anddriver.*
- Once an object has been claimed, no one else should be able to modify it except the original
owner
, anddriver.user
(driver.user
should only be able to modifypending
anddriver.*
)
Is this possible, and if so what would these rules look like?
This is not a duplicate, it has nothing to do with Getters or Setters. This is a question about Firebase Rules - https://firebase.google.com/docs/database/security/securing-data