I set security rules for my database Google Cloud Firestore
. I try to allow deletion of a document only if its time value exceeds 30 days in the past using the following logic:
allow delete: if
resource.data.locked == false
&& (request.time - resource.data.timeStamp).seconds > 2592000;
When I try to do this, I get Error: Missing or insufficient permissions
. So the first question is - am I going to do it wrong or is my logic corrupted?
And as the next question, is there a way to debug the rules? Perhaps the equivalent console.log
, thanks to which I can see the result of conditional rules as they are applied and verify that I am not sending a string instead of a timestamp or something so stupid?
I assume that request.time
there is “now” and that my is resource.data.timeStamp
correct, and one minus the other returns a Duration
and that thatDuration.seconds
returns number
, but I am newb, and any of these assumptions may be wrong, and it would be great to see these values as they are processed.
Greets everyone
source
share