Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested objects within auth not working. #75

Closed
pthrasher opened this issue Oct 31, 2016 · 5 comments
Closed

Nested objects within auth not working. #75

pthrasher opened this issue Oct 31, 2016 · 5 comments
Milestone

Comments

@pthrasher
Copy link
Contributor

pthrasher commented Oct 31, 2016

I've created a simple test that fails in targaryen, but passes on firebase simulator.

Test:
{
  "root": {
    "chats": {
      "chat-01": {
        "orgID": "org-01"
      }
    }
  },

  "users": {
    "user01": {
      "uid": "user-01",
      "orgs": {
        "org-01": true
      }
    }
  },

  "tests": {
    "chats/chat-01": {
      "canRead": [ "user01" ]
    }
  }
}
Rules:
{
  "rules": {
    "chats": {
      "$chatID": {
        ".read": "root.child('chats').child($chatID).child('orgID').val() != null && auth.orgs != null && auth.orgs[root.child('chats').child($chatID).child('orgID').val()] == true"
      }
    }
  }
}

For easier reading, here's the rule pretty-printed:

root.child('chats').child($chatID).child('orgID').val() != null
&&
auth.orgs != null
&&
auth.orgs[ root.child('chats').child($chatID).child('orgID').val() ] == true
@dinoboff
Copy link
Collaborator

dinoboff commented Nov 1, 2016

@pthrasher thanks.

Fixed on master. Will be released today in v2.3.0.

@dinoboff
Copy link
Collaborator

dinoboff commented Nov 1, 2016

@pthrasher

ps: sorry about the PR.
pps: v2.3.0 is released

@simenbrekken
Copy link

I might be misunderstanding but I'm suddenly getting failed tests after upgrading to 2.3.0 from 2.2.0.

The following passed in 2.2.0 but no longer passes in 2.3.0:

Rule: root.child('projects').child($projectId).child('users').child(auth.uid).val() != null

Context:

$projectId = 'palace'
auth = null
root = { projects: { palace: { users: { frank: { role: 'user } } } } }

The evaluated expression is then: root.projects.palace.users[null].val() != null which should fail.

@dinoboff
Copy link
Collaborator

dinoboff commented Nov 18, 2016

It's the same issue as #86 in the next branch. it's related to #65. I reopened the issue.

@dinoboff
Copy link
Collaborator

@simenbrekken It should be fixed v2.3.2

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

Successfully merging a pull request may close this issue.

3 participants