Code Monkey home page Code Monkey logo

Comments (8)

dinoboff avatar dinoboff commented on August 24, 2024

Hi, which version are your using?

ps: the rules only allow read and write of A/B/C. Anything else than a read of or write to A/B/C. (or patch of A/B with an object having only a C property) would fail:

  • 1, 5, 6 and 7 should fail.
  • 2, 6 and 8 fail as I would expected.
  • 3 and 4 pass as expected.

from targaryen.

dinoboff avatar dinoboff commented on August 24, 2024

Please reopen if you can provide more details.

from targaryen.

Maradox avatar Maradox commented on August 24, 2024

Sorry for the late reply. I used 2.3.3, but I just updated now.

Just to clarify, because maybe I misunderstood the behavior of the patch rule.
Lets say I have a rule which only allows writes to:
A/B/C and A/X/Z
Firebase currently supports multi-location updates, so for example:
root.child("A").update("B: {C: ...}, X: {Z: ...}") does work.

Can this be simulated with a rule using patch?

from targaryen.

dinoboff avatar dinoboff commented on August 24, 2024

Targaryen support multi-location updates.

Assuming you have the following rules:

{
  "rules": {
    "A": {
      "$foo": {
        "$bar": {
          ".read": true,
          ".write": true
        }
      }
    }
  }
}

Firebase allows something like that:

root.child("A").update({
  "B/C": "something",
  "X/Y": "something"
})

But not:

root.child("A").update({
  B: {C: "something"},
  X: {Y: "something"}
})

At least that how I understand it and how targaryen@3 simulates it.

https://firebase.google.com/docs/reference/js/firebase.database.Reference#update
https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.html

from targaryen.

Maradox avatar Maradox commented on August 24, 2024

Actually this is supported by multi-location updates as far as I know and is also backed by the fact that our setup works in production:
/groupRelations/{uid0}/requests/{uid1} is writeable. Nodes above are not writeable.

Then we do the following:

const updates = {
  [groupId + '/requests/' + userId]: data,
  [userId + '/requests/' + groupId]: data
}
db.ref('groupRelations').update(updates)

from targaryen.

dinoboff avatar dinoboff commented on August 24, 2024

Please read again what I wrote; Targaryen@3 support multilocation write operations using the patch assertion tests.

The failing operations I pointed out are failing because they are targeting a level without write permissions.

Please check dinoboff@be60fdf for an example.

from targaryen.

Maradox avatar Maradox commented on August 24, 2024

I will create an example project to test something I think is not working correctly. I will open a different issue if this is the case.

from targaryen.

dinoboff avatar dinoboff commented on August 24, 2024

Thanks.

from targaryen.

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.