Is there a way to store a custom expression in Firebase Rules to be reused? -


i able reuse expression in firebase rules multiple times.

if have following rules:

{   "rules": {     ".read": true,     ".write": false,     "secretarea1": {       ".read": "root.child('users').child(auth.uid).child('role').val() === 'admin'",       ".write": "root.child('users').child(auth.uid).child('role').val() === 'admin'"     },     "secretarea2": {       ".read": "root.child('users').child(auth.uid).child('role').val() === 'admin'",       ".write": "root.child('users').child(auth.uid).child('role').val() === 'admin'"     }   } } 

is there way store root.child('users').child(auth.uid).child('role').val() === 'admin' somewhere doesn't have repeated 4 times?

something like:

{   "rules": {     ".read": true,     ".write": false,     "secretarea1": {       ".read": "isadmin",       ".write": "isadmin"     },     "secretarea2": {       ".read": "isadmin",       ".write": "isadmin"     }   } } 

maybe i'm approaching wrong way. suggestions great!

i discovered blaze compiler linked @ security & rules libraries. not looking , adds compile step seems provide functionality looking for. nice if included option in firebase dashboard.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -