Jump to: navigation, search

Firebase Realtime Database Rules

99 bytes added, 17:37, 30 August 2017
no edit summary
As previously outlined, the .read and .write rule types are used to declare the circumstances under which the data in a realtime database may be read and written by users.
=== Data Validation Rules ===
The above example establishes a rule that checks the uid in the profiles section of the database. If the auth variable is null (in other words the user has not been authenticated), or the uid read from the database node for which access is being requested does not match the uid of the current user access is denied. In order to fully explain the way in which the rule works, it is first necessary to understand the concept of $ variables.
== $ Variables ==
=== 'John Wilson'"
The above examples test whether data already contained within the database meets specified criteria. The newData variable can be used in a similar manner to verify that the data about to be written to the database complies with the database rule declaration. In the following example, the rule requires that the data being written to the database contain a string value at the path /data/username and that the existing database has a true Boolean value at the /data/settings/updates key path:

Navigation menu