googlearchive / firebase-util

An experimental toolset for Firebase
http://firebase.github.io/firebase-util
MIT License
276 stars 67 forks source link

Intersections not working with partial read access #12

Closed elaval closed 9 years ago

elaval commented 10 years ago

Not sure if this is an issue or if I don't know how to configure firebase-util correctly, but I am having problems accessing records in the following cases (when I apply firebase security rules)

List of posts from a given user: /users/{userId}/posts/{postId}/true

All posts with detailed information (and a list of users who have access to them) /posts/{postId}/users/{userId}true

I have configured my firebase access rules to:

When I use a firebase-util intersection , I get an empty result because the user does not have read access to the whole /posts ref (if open full read access it works).

I guess that if firebase-util intersection requires to load both full lists before going for the intersection the access rules will fail. BUT if it tries to access all the posts from one list (the users/posts list) and then just the matching posts from /posts ... it might work. How does it actually work?

Is it a requirement of the firebase-util to have full read rights to the complete sets of intersecting resources?

katowulf commented 10 years ago

I believe that the first reference passed into intersection is considered the master. It is loaded in full, and then the adjoining references are only consulted if the record exists in the master. If that's not the case, we can address it in the upcoming refresh in a couple of weeks.

elaval commented 10 years ago

Thanks!! I tried it that way but was not successful. I will wait for the next refresh!!

Thanks

katowulf commented 9 years ago

Next refresh is 0.2 going out this week. Intersections will be implicit based on the first ref provided, which is considered the master.