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

Permission denied to bind a collection which user has read access to #280

Closed
hs-sundeep opened this issue May 23, 2019 · 4 comments
Closed

Comments

@hs-sundeep
Copy link

I have a collection to which all users have read access but only admin users have read/write access. When logged in as admin I can bind the collection to vuex state but for other users calling bindFirestoreRef throws the following error:

Uncaught Error in onSnapshot: FirebaseError: Missing or insufficient permissions

My code:

// Ref is a Query on the collection
bindRef: firestoreAction (async ({ bindFirestoreRef }, ref) => {
  // Added below line to check permission
  const snap = await ref.get(); // Works for all user
  await bindFirestoreRef('list', ref); // Throws error for non admin users
})
@posva
Copy link
Member

posva commented May 23, 2019

This is weird Vuefire only do read access. I would need a boiled down repro to check this: you can send me the boiled down rules and a small set of data so I can check it

@hs-sundeep
Copy link
Author

I figured out the issue. Documents in my collection had references to other documents to which user didn't have access to. Making maxRefDepth = 0 fixed the issue.
But I have another issue now. My document has 2 fields which are references I want to bind one of those references and leave the other reference(users do not have access to this document) unbinded.

@posva
Copy link
Member

posva commented May 23, 2019

That isn't possible yet. Can you open a separate issue with an api proposal please?

@posva posva closed this as completed May 23, 2019
@hs-sundeep
Copy link
Author

Added #281

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

No branches or pull requests

2 participants