Is it possible to restrict the amount of data ('gate' the data) sent to
unauthenticated (angularFire) clients in firebase?
Here I am fetching the data using angularFire:
angular.module('FireApp', ['firebase'])
.controller('Document', function($scope, $routeParams, angularFire){
var url = "https://my-account.firebaseio.com/test" + "/" +
$routeParams.data;
angularFire(url, $scope, data);
});
The problem is that this will load the
'https://my-account.firebaseio.com/test/data' and all of its children and
grandchildren etc..
The '/data' is an array of objects, which can (but doesn't have to - it
could very well be an array of Strings) look similar to the parent of
"/data":
data: ["0" : {
"data" : [...],
"meta" : {
"active" : false
},
"sign" : [...]
},
"1" : {
"data" : [...],
"meta" : {
"active" : true
},
"sign" : {...}
},
"2" : {
"data" : [...],
"meta" : {
"active" : false
},
"sign" : {...}
}]
Basically, I want all unauthenticated angularFire clients to receive ONLY
those elements of the data array, where the boolean flag meta.active =
true, i.e. the active flag need to decide whereas its grandparent will be
sent to the client upon the angularFire request. Only authenticated
clients should receive all the data. Can I make such rules with Firebase
Simple Login and Security Rules? If this can't be done for a grandparent,
the 'active' flag can be moved one level up to affect its parent instead.
Thank you for your time, Jared
No comments:
Post a Comment