Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Firebase Database Rules How To Deal With - Olek...
Search
GDG Ternopil
January 21, 2017
Programming
88
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Firebase Database Rules How To Deal With - Oleksandr Pidlisnyi
Firebase Database Rules How To Deal With - Oleksandr Pidlisnyi
GDG Ternopil
January 21, 2017
More Decks by GDG Ternopil
See All by GDG Ternopil
Semi supervised learning with Autoencoders by Ілля Горев
gdgternopil
2
100
Застосування ML в реальних проектах - Андрій Дерень
gdgternopil
2
140
Android Architecture Components by Ihor Dzikovskyy
gdgternopil
0
190
First look at Room Persistence by Oleksiy Sazhko
gdgternopil
0
140
Mobile Applications Architecture by Constantine Mars
gdgternopil
1
130
Tuning your SQLite with SQLDelight & SQLBrite - Mkhytar Mkhoian
gdgternopil
0
300
Speeding up development with AutoValue - Andrii Rakhimov
gdgternopil
1
120
The Mistery of Gradle Plugins - Dmytro Zaitsev
gdgternopil
1
110
Xamarin Build native Android & iOS apps with C# - Vitalii Smal
gdgternopil
1
140
Other Decks in Programming
See All in Programming
Kubernetes祭り #2 OP/ED
bells17
0
110
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
370
contenteditable と日本語入力に向き合う
colorful12
0
190
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.1k
Domain-Driven Transformation
hschwentner
2
2.3k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
710
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
400
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
190
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
360
ジョジョの世界をXRで再現する
mofurune
0
150
速習iPhone Duo対応
yuukiw00w
2
980
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
sira's awesome portfolio website redesign presentation
elsirapls
0
450
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
560
The SEO identity crisis: Don't let AI make you average
varn
0
580
How STYLIGHT went responsive
nonsquared
100
6.3k
Evolving SEO for Evolving Search Engines
ryanjones
0
320
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
580
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
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!