Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Firebase Database Rules How To Deal With - Olek...
Search
GDG Ternopil
January 21, 2017
Programming
0
71
Firebase Database Rules How To Deal With - Oleksandr Pidlisnyi
Firebase Database Rules How To Deal With - Oleksandr Pidlisnyi
GDG Ternopil
January 21, 2017
Tweet
Share
More Decks by GDG Ternopil
See All by GDG Ternopil
Semi supervised learning with Autoencoders by Ілля Горев
gdgternopil
1
73
Застосування ML в реальних проектах - Андрій Дерень
gdgternopil
1
100
Android Architecture Components by Ihor Dzikovskyy
gdgternopil
1
150
First look at Room Persistence by Oleksiy Sazhko
gdgternopil
1
95
Mobile Applications Architecture by Constantine Mars
gdgternopil
2
69
Tuning your SQLite with SQLDelight & SQLBrite - Mkhytar Mkhoian
gdgternopil
0
250
Speeding up development with AutoValue - Andrii Rakhimov
gdgternopil
0
73
The Mistery of Gradle Plugins - Dmytro Zaitsev
gdgternopil
0
58
Xamarin Build native Android & iOS apps with C# - Vitalii Smal
gdgternopil
0
82
Other Decks in Programming
See All in Programming
Jakarta EE meets AI
ivargrimstad
0
790
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
350
React CompilerとFine Grained Reactivityと宣言的UIのこれから / The next chapter of declarative UI
ssssota
4
270
Amazon Qを使ってIaCを触ろう!
maruto
0
420
RubyLSPのマルチバイト文字対応
notfounds
0
120
初めてDefinitelyTypedにPRを出した話
syumai
0
430
我々のデザインシステムは Chakra v3 にアップデートします
shunya078
2
100
Jakarta EE meets AI
ivargrimstad
0
260
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
720
Quine, Polyglot, 良いコード
qnighy
4
650
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
65
11k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
KATA
mclloyd
29
14k
Code Reviewing Like a Champion
maltzj
520
39k
Making Projects Easy
brettharned
115
5.9k
Happy Clients
brianwarren
98
6.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
RailsConf 2023
tenderlove
29
900
Producing Creativity
orderedlist
PRO
341
39k
Transcript
Firebase Database Rules How To Deal With Oleksandr Pidlisnyi Senior
Software Engineer @ Perfectial LLC GDG Lviv
Firebase Realtime Database
WHAT IF I TELL YOU IT IS NOT DATABASE
None
Database? SQL NoSQL JSON
Realtime
None
Offline
Accessible from Client Devices Android iOS Web SDK for Node.js,
C++, JAVA, Unity
Rules .read .write .validate .indexOn
now root newData data auth $ variables Predefined variables
provider uid token auth
.validate { "rules": { "foo": { ".validate": "newData.isString() && newData.val().length
< 100" } } }
.indexOn – orderByChild { "lambeosaurus": { "height": 2.1, "length": 12.5,
"weight": 5000 }, "stegosaurus": { "height": 4, "length": 9, "weight": 2500 } }
.indexOn – orderByChild { "rules": { "dinosaurs": { ".indexOn": ["height",
"length"] } } }
.indexOn – orderByValue { "scores": { "bruhathkayosaurus": 55, "lambeosaurus": 21,
"linhenykus": 80, "pterodactyl": 93, "stegosaurus": 5, "triceratops": 22 } }
.indexOn – orderByValue { "rules": { "scores": { ".indexOn": ".value"
} } }
.read && .write { "rules": { "foo": { ".read": true,
".write": false } } }
.read && .write { "rules": { "users": { "$uid": {
".write": "$uid === auth.uid" } } } }
Magic { "users": { "John Doe": { "rules": { "blog":
true } }, "John Snow": { "rules": { "blog": false } } }
Magic "blog": { "1": { "title": "Blog Post 1" },
"2": { "title": "Blog Post 2" } } }
Magic "blog": { ".read": true, ".write": "root.child('users').child(auth.uid).child('rules').child('blog').val() === true" }
Magic "$collection": { ".read": true, ".write": "root.child('users').child(auth.uid).child('rules').child($collection).val() === true" }
Magic { "users": { "John Doe": { "rules": { "blog":
{ "read": true, "write": false } } } } }
Magic "$collection": { ".read": "root.child('users').child(auth.uid).child('rules').child($collection).child ('read').val() === true", ".write": "root.child('users').child(auth.uid).child('rules').child($collection).child
('write').val() === true" }
+OleksandrPidlisnyi @opidlisnyi fb.me/opidlisnyi Questions? Thank you!