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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
GDG Ternopil
January 21, 2017
Programming
83
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
94
Застосування ML в реальних проектах - Андрій Дерень
gdgternopil
2
130
Android Architecture Components by Ihor Dzikovskyy
gdgternopil
0
180
First look at Room Persistence by Oleksiy Sazhko
gdgternopil
0
130
Mobile Applications Architecture by Constantine Mars
gdgternopil
1
110
Tuning your SQLite with SQLDelight & SQLBrite - Mkhytar Mkhoian
gdgternopil
0
290
Speeding up development with AutoValue - Andrii Rakhimov
gdgternopil
1
110
The Mistery of Gradle Plugins - Dmytro Zaitsev
gdgternopil
1
95
Xamarin Build native Android & iOS apps with C# - Vitalii Smal
gdgternopil
1
130
Other Decks in Programming
See All in Programming
OS アップデート対応の取り組み方がもっと共有されてほしい
andpad
0
110
AI 輔助遺留系統現代化的經驗分享
jame2408
1
1.1k
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
14
6.6k
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
970
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
190
エンジニア向け会社紹介/Findy Company Profile
findyinc
6
360k
Contextとはなにか
chiroruxx
1
390
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
210
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
230
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
8.5k
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
630
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
250
Featured
See All Featured
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
620
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
170
Context Engineering - Making Every Token Count
addyosmani
9
1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Leo the Paperboy
mayatellez
7
1.9k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
220
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Music & Morning Musume
bryan
47
7.3k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
220
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
180
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
410
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!