Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Producing global read/write rules #29

Closed
erikcw opened this issue Dec 19, 2014 · 2 comments
Closed

Producing global read/write rules #29

erikcw opened this issue Dec 19, 2014 · 2 comments

Comments

@erikcw
Copy link

erikcw commented Dec 19, 2014

Just getting started with a simple rule set:

functions:
  - isLoggedIn(): auth.id !== null

schema: {}

access:
  - location: dashboard/$slug/
    read:  isLoggedIn() && prev.user === auth.uid
    write: false

Produces:

{
  "rules":{
    ".write":"false",
    ".read":"false"
  }
}

What happened to the write rules?

This is what I'm trying to recreate:

{
    "rules": {
        "dashboard": {
          "$slug": {
            ".read": "data.child('user').val() === auth.uid",
            ".write": false
          }
        }
    }
}
@tomlarkworthy
Copy link
Contributor

Hmm. You need some schema for the access to bind to. Probably it should
scaffold this for you but blaze is meant to be more type safe than the old
rules.
schema: {properties: {dashboard: { $slug {}}}

Should do it. I'll add a case for this though
On 18 Dec 2014 17:20, "Erik Wickstrom" notifications@github.com wrote:

Just getting started with a simple rule set:

functions:

  • isLoggedIn(): auth.id !== null

schema: {}

access:

  • location: dashboard/$slug/
    read: isLoggedIn() && prev.user === auth.uid
    write: false

Produces:

{
"rules":{
".write":"false",
".read":"false"
}
}

What happened to the write rules?

This is what I'm trying to recreate:

{
"rules": {
"dashboard": {
"$slug": {
".read": "data.child('user').val() === auth.uid",
".write": false
}
}
}
}


Reply to this email directly or view it on GitHub.

@tomlarkworthy
Copy link
Contributor

candidate fix in 0.0.34, sorry it took so long, i was quite a hard transformation, I hope I have it right.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants