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
Firestoreのルール設定 割と何でも出来てビビる/Firestore rule s...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kkznch
May 17, 2019
Technology
1
840
Firestoreのルール設定 割と何でも出来てビビる/Firestore rule setting
Webナイト宮崎 Vol.4
登壇枠で使用
参考URL
https://tegehoge.connpass.com/event/128502/
kkznch
May 17, 2019
Tweet
Share
More Decks by kkznch
See All by kkznch
黒い画面へようこそ/Hello, black screen
kkznch
0
420
VueRouterとNuxtのルーティング/VueRouter and Nuxt Routing
kkznch
0
380
Vuexで何を管理する方が良い?/What is better to store in Vuex?
kkznch
1
780
LaraCSVで手軽にCSVを出力する/Easily generate CSV by LaraCSV
kkznch
0
1.7k
自社サービス チャット機能に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.3k
Laravel Telescopeが便利そうな気がする/Laravel Telescope seems to be convenience
kkznch
1
1.2k
Laravel Novaはなんだかいい感じらしい/Laravel Nova seems to be nice
kkznch
0
670
Laravel5.5的 継続的インテグレーション / Laravel 5.5 Continuous Integration
kkznch
3
3.7k
Other Decks in Technology
See All in Technology
Serverless Agent Architecture on Azure / serverless-agent-on-azure
miyake
1
110
LINE Messengerの次世代ストレージ選定
lycorptech_jp
PRO
8
4.1k
Data Hubグループ 紹介資料
sansan33
PRO
0
2.8k
オンプレとGoogle Cloudを安全に繋ぐための、セキュア通信の勘所
waiwai2111
3
1k
「使いにくい」も「運用疲れ」も卒業する UIデザイナーとエンジニアが創る持続可能な内製開発
nrinetcom
PRO
1
760
全自動で回せ!Claude Codeマーケットプレイス運用術
yukyu30
3
150
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
71k
三菱UFJ銀行におけるエンタープライズAI駆動開発のリアル / Enterprise AI_Driven Development at MUFG Bank: The Real Story
muit
10
20k
Digitization部 紹介資料
sansan33
PRO
1
6.9k
俺の失敗を乗り越えろ!メーカーの開発現場での失敗談と乗り越え方 ~ゆるゆるチームリーダー編~
spiddle
0
420
男(監査)はつらいよ - Policy as CodeからAIエージェントへ
ken5scal
5
680
LINEヤフーにおけるAI駆動開発組織のプロデュース施策
lycorptech_jp
PRO
0
200
Featured
See All Featured
Paper Plane (Part 1)
katiecoart
PRO
0
5k
4 Signs Your Business is Dying
shpigford
187
22k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
170
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
130
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
170
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
Speed Design
sergeychernyshev
33
1.6k
Being A Developer After 40
akosma
91
590k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
250
How STYLIGHT went responsive
nonsquared
100
6k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.7k
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()ͳͲΛΈ߹Θͤͯࡉ͔͍ઃఆ͕Մೳ •
దʹϧʔϧΛઃఆͯ͠ใΛकΓ·͠ΐ͏