Skip to content

Commit 026fbf5

Browse files
author
Your Name
committed
Stripe In Practice Course
1 parent 320dcff commit 026fbf5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

firestore.rules

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ service cloud.firestore {
66
return exists(/databases/$(database)/documents/users/$(userId)/coursesOwned/$(courseId))
77
}
88

9+
function isSubscriber(userId) {
10+
return "pricingPlanId" in get(/databases/$(database)/documents/users/$(userId)).data
11+
}
12+
913
function isUserWithId(userId) {
1014
return request.auth.uid == userId;
1115
}
@@ -14,7 +18,7 @@ service cloud.firestore {
1418
allow read: if true;
1519

1620
match /lessons/{lessonId} {
17-
allow read: if userOwnsCourse(request.auth.uid,courseId)
21+
allow read: if userOwnsCourse(request.auth.uid,courseId) || isSubscriber(request.auth.uid)
1822
}
1923
}
2024

0 commit comments

Comments
 (0)