Browse Source

Fixing README for text moderation

ryanpbrewster-patch-1
Nicolas Garnier 9 years ago
parent
commit
42537a45c6
  1. 8
      text-moderation/README.md

8
text-moderation/README.md

@ -14,7 +14,7 @@ The dependencies are listed in [package.json](package.json).
## Sample Database Structure ## Sample Database Structure
Users anonymously add a message text to the `/messages` list: Users anonymously add a message - an object with a `text` attribute - to the `/messages` list:
``` ```
/functions-project-12345 /functions-project-12345
@ -45,8 +45,8 @@ Below is the trigger rule for the `moderator` function making sure it's triggere
## Security Rules ## Security Rules
The following security rules ensures users cannot read a message before it has been sanitized. The function adds a `sanitize` attribute (boolean) to the messages once they have been moderated. The following security rules ensures users cannot read a message before it has been sanitized. The function adds a `sanitized` attribute (boolean) to the messages once they have been moderated.
Also we make sure that users can only create a message and not edit them. We also make sure they cannot set the sanitized flag already. Also we make sure that users can only create a message and not edit them again after moderation. We also make sure they cannot set the sanitized flag already.
``` ```
{ {
@ -55,7 +55,7 @@ Also we make sure that users can only create a message and not edit them. We als
"$message": { "$message": {
// Users can only add new messages. Not modify or delete them. Also makes sure they cannot mark a message as // Users can only add new messages. Not modify or delete them. Also makes sure they cannot mark a message as
// already sanitized. // already sanitized.
".write": "!data.exists() && !newData.child('sanitized').exists()'" ".write": "!data.exists() && !newData.child('sanitized').exists()'",
".read": "data.child('sanitized').val() === true" ".read": "data.child('sanitized').val() === true"
} }
} }

Loading…
Cancel
Save