@edgedev/firebase 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/edgeFirebase.js +6 -2
- package/src/firestore.rules +3 -3
package/package.json
CHANGED
package/src/edgeFirebase.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// TODO: THE permissionCheck will call a cloud function that will check the user's permissions also...
|
|
2
|
+
// This could function will right to "rules-helpers" collction a document with the user's uid and the collection path and the permission
|
|
3
|
+
// This will make the rules far more efficient and will allow for more complex rules // this only needs done really for snapshots...
|
|
4
|
+
// All the other document reads and writes should be made using a cloud functions exclusively and the cloud function will check the permissions
|
|
1
5
|
const { onCall, HttpsError, logger, getFirestore, functions, admin, twilio, db } = require('./config.js')
|
|
2
6
|
|
|
3
7
|
const authToken = process.env.TWILIO_AUTH_TOKEN
|
|
@@ -278,9 +282,9 @@ function setUser(userRef, newData, oldData, stagedDocId) {
|
|
|
278
282
|
let userUpdate = { meta: newData.meta, stagedDocId }
|
|
279
283
|
|
|
280
284
|
if (newData.meta && newData.meta.name) {
|
|
281
|
-
const publicUserRef = db.collection('public-users').doc(newData.
|
|
285
|
+
const publicUserRef = db.collection('public-users').doc(newData.uid)
|
|
282
286
|
const publicMeta = { name: newData.meta.name }
|
|
283
|
-
publicUserRef.set({ uid: newData.uid, meta: publicMeta, collectionPaths: newData.collectionPaths, userId: newData.
|
|
287
|
+
publicUserRef.set({ uid: newData.uid, meta: publicMeta, collectionPaths: newData.collectionPaths, userId: newData.uid })
|
|
284
288
|
}
|
|
285
289
|
|
|
286
290
|
if (Object.prototype.hasOwnProperty.call(newData, 'roles')) {
|
package/src/firestore.rules
CHANGED
|
@@ -10,13 +10,13 @@ service cloud.firestore {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
match /databases/{database}/documents/public-users/{user} {
|
|
13
|
-
allow read: if
|
|
14
|
-
allow list: if
|
|
13
|
+
allow read: if request.auth != null;
|
|
14
|
+
allow list: if request.auth != null;
|
|
15
15
|
allow create: if false;
|
|
16
16
|
allow update: if false;
|
|
17
17
|
allow delete: if false;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
match /databases/{database}/documents/events/{event} {
|
|
21
21
|
allow read: if false;
|
|
22
22
|
allow create: if false;
|