-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Version info
Angular: 6.0.2
Firebase: 5.0.4
AngularFire: 5.0.0-rc.10
Which is my problem?
In firestore simulator action pass validation but in app show error with insufficient permissions.
This is my query:
this.resultCol = this.afs.collection('messages', ref => ref.where('orderId', '==', this.id).orderBy('created', 'desc') );
Question: Why in the firestore simulator is alright but in real action doesn't
Security rules:
service cloud.firestore {
match /databases/{database}/documents {
match /users/{user} {
allow create: if request.auth != null;
}
match /messages/{message} {
function isConvParticipant() {
return request.auth.uid == request.resource.data.clientId || request.auth.uid == request.resource.data.ownerId;
}
function isLoggedAndExist() {
return request.auth != null && exists(/databases/$(database)/documents/users/$(request.auth.uid));
}
allow get: if isLoggedAndExist();
allow list: if isLoggedAndExist() && request.auth.uid == resource.data.clientId || request.auth.uid == resource.data.ownerId;
allow create: if isLoggedAndExist() && isConvParticipant();
}
}
}
Metadata
Metadata
Assignees
Labels
No labels