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
Firestoreのルール設定 割と何でも出来てビビる/Firestore rule s...
Search
kkznch
May 17, 2019
Technology
890
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Firestoreのルール設定 割と何でも出来てビビる/Firestore rule setting
Webナイト宮崎 Vol.4
登壇枠で使用
参考URL
https://tegehoge.connpass.com/event/128502/
kkznch
May 17, 2019
More Decks by kkznch
See All by kkznch
黒い画面へようこそ/Hello, black screen
kkznch
0
440
VueRouterとNuxtのルーティング/VueRouter and Nuxt Routing
kkznch
0
400
Vuexで何を管理する方が良い?/What is better to store in Vuex?
kkznch
1
810
LaraCSVで手軽にCSVを出力する/Easily generate CSV by LaraCSV
kkznch
0
1.8k
自社サービス チャット機能にFirebaseが導入されてた/Firebase was introduced to the chat function of our service
kkznch
0
1.3k
SPA開発未経験者によるNuxt.jsを使った自社サービス開発 / Development of own service using Nuxt.js by inexperienced SPA development
kkznch
3
3.4k
Laravel Telescopeが便利そうな気がする/Laravel Telescope seems to be convenience
kkznch
1
1.3k
Laravel Novaはなんだかいい感じらしい/Laravel Nova seems to be nice
kkznch
0
680
Laravel5.5的 継続的インテグレーション / Laravel 5.5 Continuous Integration
kkznch
3
3.7k
Other Decks in Technology
See All in Technology
なぜAI任せのゲームは面白くならないのか?
hirohasuyoutube
0
320
顧客の成果創出とプロダクトの成長を 両立するためのFDE
sansantech
PRO
0
500
VS Code × GitHub Copilot での Fabric 開発
ryomaru0825
1
180
Mastering Agentic Development: Harness Engineering for Effective Coding Agents
konippi
3
660
Databricksメトリクスビューはじめてのもくもく会
taka_aki
0
140
Snowflake Horizon Catalog と Apache Iceberg で作る オープンなデータ基盤
kitagawaz
0
340
メルカリにおけるAI時代の高速プロトタイピング基盤「Arca」
ryotarai
18
13k
Meet AgentCore Identity Consent Portal
hironobuiga
2
130
Swap and Memory Reclaim - Squeezing Out More RAM
ennael
PRO
1
1.3k
高負荷プロダクション環境におけるAWS Lambdaのリアル 〜スケールとコストを左右する実行ライフサイクルの技術仕様〜
maimyyym
2
830
Making AI Agents Safe and Fast- Jev, Obsidian, and the Meta-Harness
x5gtrn
PRO
0
160
Azure Copilot Resiliency Agentをいろいろ試してみる
tomokusaba
0
140
Featured
See All Featured
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
470
WENDY [Excerpt]
tessaabrams
14
39k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
200
What's in a price? How to price your products and services
michaelherold
247
13k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Designing Experiences People Love
moore
143
24k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
560
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Optimising Largest Contentful Paint
csswizardry
37
4k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
540
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
So, you think you're a good person
axbom
PRO
2
2.2k
Transcript
Firestoreͷϧʔϧઃఆ ׂͱԿͰग़དྷͯϏϏΔ גࣜձࣾRe:Build Յ ါىʢ@kkznchʣ 20195݄17ʢۚʣ WebφΠτٶ࡚ Vol.4 ʙͯ͛FirebaseΛֶͼ͍ͨʙ
͚͚ͣΜ @kkznch Յ ါى 1990ͷԭೄੜ·Ε ిྗձࣾͷITΠϯϑϥɺηΩϡϦςΟ ↓ גࣜձࣾRe:BuildͰWebΤϯδχΞ
ձࣾհ • גࣜձࣾRe:Buildʢ201711݄ʹઃཱʣ • ݱࡏͷࣾһ໊̑ • ԭೄΛڌͱ͠ɺجຊతʹLaravelVue.jsΛ ͬͯडୗɾࣗࣾαʔϏε։ൃΛ͍ͯ͠Δ • ϦϞʔτϫʔΫɺࣗ༝ͳಇ͖ํΛਪ͍ͯ͠Δ
Firestore
Google͕ఏڙ͢ΔNoSQL DB
֊ܕσʔλߏ ΞΫηεϧʔϧΛઃఆͰ͖Δ
͠ϧʔϧΛઃఆ͠ͳ͍ͱ…
Databaseͷϧʔϧ
֊͝ͱʹϧʔϧΛద༻ usersͱɺͦͷதͷimagesʹ ରͯͦ͠ΕͧΕϧʔϧΛద༻Ͱ͖Δ service cloud.firestore { match /databases/{database}/documents { match
/users/{userId} { // rules… match /images/{imageId} { // rules… } } } }
֊ҎԼશͯʹϧʔϧΛద༻ service cloud.firestore { match /databases/{database}/documents { match /{users=**} {
// rules… } } } usersͱͦͷԼҐશͯʹϧʔϧΛద༻
allowϧʔϧྫ̍ʢςετ༻ʣ service cloud.firestore { match /databases/{database}/documents { match /{document=**} {
allow read, write: if true; } } } υΩϡϝϯτશମʹৗʹread, writeΛallow͢ΔΑ
allowϧʔϧྫ̎ service cloud.firestore { match /databases/{database}/documents { match /{document=**} {
allow read, write: if request.auth != null; } } } ϩάΠϯ͍ͯ͠ΔͳΒread, writeΛallow͢ΔΑ
allowͷछྨ • read ‣ get ‣ list • write ‣
create ‣ update ‣ delete
request, resource ม • request ‣ ΫϥΠΞϯτ͔ΒͷϦΫΤετʹؔ ͢ΔใΛࢀরͰ͖Δ • resource
‣ ݱࡏͷDBͷঢ়ଶΛࢀরͰ͖Δ
get(), exists() ϝιου • get() ‣ Ҿʹ༩͑ͨύε͔ΒΦϒδΣΫτ Λऔಘ͢Δ • exists()
‣ Ҿʹ༩͑ͨύεʹΦϒδΣΫτ͕ ଘࡏ͢Δ͔boolͰฦ͢
in ʹ͍ͭͯ • if x in y ‣ x͕ྻyʹؚ·Ε͍ͯΔ͔ΛνΣο Ϋ͢Δ
Έ߹ΘͤΔͱ͍͍ײ͡ʹͳΔ service cloud.firestore { match /databases/{database}/documents { function getRoom(roomId) {
return get(/databases/{database}/documents/rooms/{roomId}); } match /rooms/{roomId} { allow read, update: if request.auth != null && request.auth.uid in getRoom(roomId).data.users; } } } ྫɿϧʔϜϝϯόʔͰ͋Εread, update͕Ͱ͖Δ
·ͱΊ
·ͱΊ • FirestoreϦιʔεຖʹೝՄͷઃఆ͕Ͱ͖Δ • allow, function, request/resourceม, get()/ exists()ͳͲΛΈ߹Θͤͯࡉ͔͍ઃఆ͕Մೳ •
దʹϧʔϧΛઃఆͯ͠ใΛकΓ·͠ΐ͏