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
Android端末で実現するオンデバイスLLM 2025
masayukisuda
1
150
AIでLINEスタンプを作ってみた
eycjur
1
230
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
1.5k
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
3
300
🔨 小さなビルドシステムを作る
momeemt
4
680
testingを眺める
matumoto
1
140
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
4
1.4k
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
220
RDoc meets YARD
okuramasafumi
4
170
はじめてのMaterial3 Expressive
ym223
2
740
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
440
OSS開発者という働き方
andpad
5
1.7k
Featured
See All Featured
Bash Introduction
62gerente
615
210k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
YesSQL, Process and Tooling at Scale
rocio
173
14k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.8k
Automating Front-end Workflow
addyosmani
1370
200k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
BBQ
matthewcrist
89
9.8k
Site-Speed That Sticks
csswizardry
10
820
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
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!