-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
layout fixes + firestore rules + sign-in bug
- Loading branch information
Showing
7 changed files
with
89 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"indexes": [], | ||
"fieldOverrides": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
rules_version = '2'; | ||
|
||
service cloud.firestore { | ||
match /databases/{database}/documents { | ||
match /{document=**} { | ||
allow read, write: if false; | ||
} | ||
match /presentations/{presentation} { | ||
allow read: if true; | ||
|
||
allow create: if request.auth != null | ||
// TODO: should this be aligned with all the possible fields? | ||
&& request.resource.data.keys().hasAll(['uid', 'created', 'username', 'pages', 'notes', 'title']) | ||
&& request.resource.data.keys().hasOnly(['uid', 'created', 'username', 'pages', 'notes', 'title']) | ||
&& request.auth.uid == request.resource.data.uid; | ||
|
||
// allow update: if request.auth != null; | ||
|
||
allow update: if request.auth != null | ||
&& request.auth.uid == resource.data.uid | ||
&& request.resource.data.diff(resource.data).affectedKeys().hasOnly(['original', 'pages', 'rendered', 'title', 'notes', 'username']); | ||
|
||
allow delete: if request.auth != null | ||
&& request.auth.uid == resource.data.uid; | ||
} | ||
match /users/{userId} { | ||
allow write: if request.auth != null && request.auth.uid == userId; | ||
allow read: if request.auth != null && request.auth.uid == userId; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
rules_version = '2'; | ||
|
||
// Craft rules based on data in your Firestore database | ||
// allow write: if firestore.get( | ||
// /databases/(default)/documents/users/$(request.auth.uid)).data.isAdmin; | ||
service firebase.storage { | ||
match /b/{bucket}/o { | ||
match /{allPaths=**} { | ||
allow read, write: if false; | ||
} | ||
match /presentations/{presentationId}/{imageId} { | ||
allow read: if true; | ||
allow write: if request.auth != null | ||
&& firestore.get(/databases/(default)/documents/presentations/$(presentationId)).data.uid == request.auth.uid; | ||
} | ||
} | ||
} |