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
85
Tuning your SQLite with SQLDelight & SQLBrite - Mkhytar Mkhoian
gdgternopil
0
270
Speeding up development with AutoValue - Andrii Rakhimov
gdgternopil
1
86
The Mistery of Gradle Plugins - Dmytro Zaitsev
gdgternopil
1
76
Xamarin Build native Android & iOS apps with C# - Vitalii Smal
gdgternopil
1
100
Other Decks in Programming
See All in Programming
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.3k
請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點
keitheis
0
120
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
[FEConf 2025] 모노레포 절망편, 14개 레포로 부활하기까지 걸린 1년
mmmaxkim
0
1.6k
Performance for Conversion! 分散トレーシングでボトルネックを 特定せよ
inetand
0
140
個人軟體時代
ethanhuang13
0
320
Compose Multiplatform × AI で作る、次世代アプリ開発支援ツールの設計と実装
thagikura
0
150
Ruby×iOSアプリ開発 ~共に歩んだエコシステムの物語~
temoki
0
270
HTMLの品質ってなんだっけ? “HTMLクライテリア”の設計と実践
unachang113
4
2.8k
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
アセットのコンパイルについて
ojun9
0
120
testingを眺める
matumoto
1
140
Featured
See All Featured
Writing Fast Ruby
sferik
628
62k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
51
5.6k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Designing Experiences People Love
moore
142
24k
Context Engineering - Making Every Token Count
addyosmani
2
41
The Cost Of JavaScript in 2023
addyosmani
53
8.9k
Speed Design
sergeychernyshev
32
1.1k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.2k
GitHub's CSS Performance
jonrohan
1032
460k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
GraphQLの誤解/rethinking-graphql
sonatard
72
11k
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!