Comments (8)
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.
Please reopen if you can provide more details.
from targaryen.
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.
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.
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.
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.
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.
Thanks.
from targaryen.
Related Issues (20)
- Wrong result for array-like collections HOT 5
- Update operation result should include the new value of the node
- Error when using string.length with empty string: "Invalid < expression: Left and right sides types are differents" HOT 4
- Flag to log only the failing conditions HOT 1
- Jest support HOT 8
- Support firestore HOT 4
- Invalid location in tests are not reported HOT 11
- Perform deep equality check when using == HOT 4
- Patch allowed on targaryen, not on firebase HOT 2
- Fix regression regarding invalid location given to RuleDataSnapshot methods HOT 2
- Testing of `.validate` rules HOT 2
- Issue checking children when passing an empty object HOT 1
- Adding the ability to test operations as an admin HOT 2
- Support `query` variable HOT 5
- Report invalid regex HOT 9
- Issue parsing queries HOT 4
- Targaryen is broken with Jest? HOT 3
- Trailing backslash produces unreliable test results HOT 6
- Empty string as child key returns the collection in Firebase, null in targaryen HOT 1
- npm dependency ip-regex requires npm 8 while firebase requires 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from targaryen.