Saving Data on Android



Download 19,28 Mb.
Pdf ko'rish
bet281/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   277   278   279   280   281   282   283   284   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

GeTng started
To see how the security rules look like open your Firestore database in the console. 
You'll see 
Rules
 tab at the top. Click on it. Then click on the 
Simulator
 icon to 
expand the simulator window:
This is where you can see your current logic for the security rules.
You'll take a deeper look into these rules next.
match /databases/{database}/documents
This line indicates the path that all the documents belong to. By default, all the 
documents belong to the 
/databases/{database}/documents
 path.
match /{document=**} { 
      ... 
}
This is where you set the rules for the specific document by specifying the path to
Saving Data on Android
Chapter 19: Securing Data in Cloud Firestore
raywenderlich.com
275


that document. 
match
 statement specifies the path to the document. 
document=**
 is 
a recursive wildcard which matches any document in the entire database. As of May 
2019, there is version 2 of the Cloud Firestore security rules which changes the 
behavior of the recursive wildcards. Check the official documentation 
https://
firebase.google.com/docs/firestore/security/get-started#security_rules_version_2
 to 
see the differences in the behavior.
In your current database, you have a posts collection that contains a specific post. 
The path to the specific post looks like this:
/databases/{database}/documents/posts/{postId}
If you only want to write a security rule that applies to that specific path you'd do it 
like this:
match /databases/{database}/documents { 
    match posts/{postId} { 
      ... 
    } 
}
As you can see, Firestore lets you nest the paths.
The first 
match
 you see will almost always look like this:
match /databases/{database}/documents
{database}
 in curly brackets is a wildcard that matches any database name. You'll 
learn more about wildcards later.
Now, your 
posts
 collection could have a subcollection. You could add a separate rule 
for that subcollection like this:
match /databases/{database}/documents { 
    match posts/{postId} { 
      match subcollection/{documentId} { 
          ... 
      } 
    } 
}
There is one important thing to notice when looking at these nested rules. The rules 
you add to the top level 
match posts/{postId}
 
do not
 apply to the inner 
match
 
statements. Security rules in Cloud Firestore do not cascade.
Saving Data on Android
Chapter 19: Securing Data in Cloud Firestore
raywenderlich.com
276



Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   277   278   279   280   281   282   283   284   ...   292




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish