Michel
Michel

Reputation: 11753

Security rules based on time limit in Firebase

On Firebase, I have a field like this:

timeStamp: ”2016-06-03 13:39:27"

In the Security & Rules section, I want to set some permission to write based on the fact that the time has not gone over the limit set in the timeStamp field. I can’t find examples similar to what I want to do on the net, and what I have tried (hereafter) did not work. To start from, I must be using the wrong syntax.

".write": "data.child('timeStamp').val() > now"

Does anyone knows how to do what I want?

Upvotes: 0

Views: 361

Answers (1)

For the timeStamp, use Unix epoch time (in milliseconds).

As per syntax error, it is difficult to determine without knowing the hierarchical structure of your data, but it looks fine in general.

You will also find the examples on Section #3 on this page helpful.

Upvotes: 1

Related Questions