Giter VIP home page Giter VIP logo

Comments (9)

mesqueeb avatar mesqueeb commented on June 18, 2024 1

@rchan I'm assuming you retrieve the variables after the user has logged in?

I'm currently writing compatibility for any arbitrary variable to be passed on dispatch('openDBChannel'). Please hold on.

from vuex-easy-firestore.

mesqueeb avatar mesqueeb commented on June 18, 2024 1

@rchan
I have made this possible through custom variables passed as parameter like so: dispatch('module/openDBChannel', {customVar: customId}).

Please update to npm i [email protected]
and check the new documentation here.

Feel free to write additional feedback or comments, or if all good please close this issue!

from vuex-easy-firestore.

mesqueeb avatar mesqueeb commented on June 18, 2024

Dear Jon.
Thanks for your issue!

I believe it’s possible even now! Just pass the user id as third argument. Doesn’t it work?

I will also do some more tests next week. Keep you posted.

from vuex-easy-firestore.

mesqueeb avatar mesqueeb commented on June 18, 2024

Oh wait I see. You don’t know the userId at the time of the settings!

I didn’t have this problem before because I only used the userid in the syncPath myself, not in the where.

So I will make this a possibility this weekend and let you know.

In the meantime I would wanna ask if this doesn’t cause you any security issues on your side? I think this way it's possible for users to edit other user's documents or to even retrieve all docs of all users. How did you set up your security rules in your case?

I have also not yet used 'array-contains' myself, so i'll research that. Either way i'd love some input on your specific use case.

from vuex-easy-firestore.

rchan avatar rchan commented on June 18, 2024

I have the same issue, although I'm only doing '==' rather than 'array-contains'

We can't have the documents separated under each user because we have an admin side of the app that needs to work on the documents as a single collection

the rule for '==' would be (from example in docs https://firebase.google.com/docs/firestore/security/rules-query)

service cloud.firestore {
  match /databases/{database}/documents {
    match /stories/{storyid} {
      // Only the authenticated user who authored the document can read or write
      allow read, write: if request.auth.uid == resource.data.author;
    }
  }
}

think dealing with 'array-contains' is also possible, but I don't have that to hand at the moment

from vuex-easy-firestore.

mesqueeb avatar mesqueeb commented on June 18, 2024

@rchan @jonbomme I just pushed version 1.7 which will automatically replace '{userId}' with the actual userId at the time you do dispatch('openDBChannel'). Make sure that you add '{userId}' just like that as third param of the where filter in sync.where.

Can you update with npm and let me know how it goes?

Let me know if there are any problems or bugs or feel free to open a new issue with other requests!

from vuex-easy-firestore.

rchan avatar rchan commented on June 18, 2024

it worked for me

however, possible to to make it any arbitrary variable? for example, one of my applications has members inside a group, so the objects they all need when inside a group would fall under either a database reference of /groups/{groupId}/things or groupId in where clause

from vuex-easy-firestore.

jonbomme avatar jonbomme commented on June 18, 2024

Cool! I will try it out later!

from vuex-easy-firestore.

rchan avatar rchan commented on June 18, 2024

no time to try it out at the moment, but API wise it would be what I want

from vuex-easy-firestore.

Related Issues (20)

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.