Giter VIP home page Giter VIP logo

firebase-course's Introduction

Firestore rules:

rules_version = '2'; service cloud.firestore {

// path - starts from the root of FB application // match has always to point ot document, but not to a collection // and it doesn't apply to nested collections // here, for example, we'll see courses details, but not its nested lessons

match /databases/{database}/documents/courses/{curseId} { allow read; allow write: if false; }

match /databases/{database}/documents { // This rule allows anyone with your database reference to view, edit, // and delete all data in your Firestore database. Expiration date is indicated match /{document=**} { allow read: if true; allow write: if request.time < timestamp.date(2021, 11, 18); // combined operations together: // allow read, write: if request.time < timestamp.date(2021, 11, 18); } } }

Syntax examples: allow read; is the same as: allow read: if true;

allow write: if false; allow write: if courseId == "aaa";

allow read: if request.auth.uid != null;; // for only authenticated users

{database} in match section - is a path variable declared to use path variable: $(..). e.g.: /databases/$(database)/documents if at least 1 rule allows read/write, then other prohibited rules won't override it; order of rules is not important

REFACTORING:
match /databases/{database}/documents/courses/0ESyIx17sC122efCYIHy { allow read; allow write: if false; }

match /databases/{database}/documents/courses/{curseId} { allow read: if false; allow write: if false; }

Is the same as: match /databases/{database}/documents/courses/{curseId} { allow read: if false; allow write: if curseId == "0ESyIx17sC122efCYIHy"; }

Permissions: READ consists of: get, list WRITE: create, update, delete

Widlcards: document=** - means to capture "all the rest of path"

Functions: function isAuthenticated() { return request.auth.uid != null; } allow read: if isAuthenticated();

HOSTING: { "source": "**", "destination": "/index.html" }

means - all the request should be served on index.html page

firebase-course's People

Contributors

angular-academy-devs avatar jhades avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.