atn832 / fake_firebase_security_rules Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Supporting resource and request.resource can be done in one of two ways.
The easy, less robust way, is for fake_cloud_firestore to populate the resource
and request.resource
objects "manually" into context
. https://github.com/atn832/fake_cloud_firestore/blob/be3e548e20fda9af263134dc813c4a8842c316db/lib/src/fake_cloud_firestore_instance.dart#L151
The other, more robust way is when calling fake_firebase_security_rules's isAllowed
, fake_firebase_security_rules should be able to ask Resource
information from the caller (fake_cloud_firestore or firebase_storage_mocks) and populate that into the context in the right places (both in resource
and request.resource
).
Maybe it could be implemented like this: implement some ResourceProvider
interface
class ResourceProvider {
// based on https://firebase.google.com/docs/reference/rules/rules.firestore.Resource.
Resource get(String path);
}
Add a resourceProvider
parameter to isAllowed
or to the FakeFirebaseSecurityRules
constructor.
Then in
orfake_firebase_security_rules/lib/src/path_match.dart
Lines 60 to 63 in cf15115
context
and context.request
.
The reason why the second approach is more robust is that neitherfake_cloud_firestore
nor firebase_storage_mocks
have to know about where that resource is put.
Anyone is free to implement a PR with unit tests and I'll gladly review it.
Because fake_cloud_firestore is using this package, it will although not work on web atm.
This might be a naming problem for one of the files and might be happening while compiling dart code into JS code.
Reproduce:
fake_firebase_security_rules:
to dependenciesFakeFirebaseSecurityRules('');
somewhere, e.g. build method.FYI: This error will only occure in debug mode, not in profile or release.
Are there any ETAs on the resource
/request.resource
and custom function features?
When can we expect these features?
Is there a way how we could contribute to that?
And also, if a rules file has missing features in it like these, will other parts of the rules file still work which do not rely on such features?
In order to implement this, one will have to first enable cel-dart to support Overloads. Then fake_firebase_security_rules should implement some functions, and instantiate Programs with a custom Environment that provides those functions.
See atn832/cel-dart#1.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.