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
73
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
2
83
Застосування ML в реальних проектах - Андрій Дерень
gdgternopil
2
110
Android Architecture Components by Ihor Dzikovskyy
gdgternopil
0
160
First look at Room Persistence by Oleksiy Sazhko
gdgternopil
0
110
Mobile Applications Architecture by Constantine Mars
gdgternopil
1
87
Tuning your SQLite with SQLDelight & SQLBrite - Mkhytar Mkhoian
gdgternopil
0
270
Speeding up development with AutoValue - Andrii Rakhimov
gdgternopil
1
88
The Mistery of Gradle Plugins - Dmytro Zaitsev
gdgternopil
1
76
Xamarin Build native Android & iOS apps with C# - Vitalii Smal
gdgternopil
1
110
Other Decks in Programming
See All in Programming
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
4
2.3k
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
1
310
Software Architecture
hschwentner
6
2.3k
オープンソースソフトウェアへの解像度🔬
utam0k
16
3k
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
1k
実践Claude Code:20の失敗から学ぶAIペアプログラミング
takedatakashi
15
5.7k
Range on Rails ―「多重範囲型」という新たな選択肢が、複雑ロジックを劇的にシンプルにしたワケ
rizap_tech
0
6.7k
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
350
CSC305 Lecture 08
javiergs
PRO
0
230
Serena MCPのすすめ
wadakatu
4
1k
Devvox Belgium - Agentic AI Patterns
kdubois
1
130
Le côté obscur des IA génératives
pascallemerrer
0
150
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
980
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
4 Signs Your Business is Dying
shpigford
185
22k
The World Runs on Bad Software
bkeepers
PRO
72
11k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Making Projects Easy
brettharned
120
6.4k
Docker and Python
trallard
46
3.6k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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!