Update firstore rules
This commit is contained in:
parent
495cbef995
commit
4902321cd3
|
@ -107,20 +107,25 @@ service cloud.firestore {
|
||||||
.hasOnly(['isSeen', 'viewTime']);
|
.hasOnly(['isSeen', 'viewTime']);
|
||||||
}
|
}
|
||||||
|
|
||||||
match /groups/{groupId} {
|
match /groups/{groupId} {
|
||||||
allow read;
|
allow read;
|
||||||
allow update: if request.auth.uid in resource.data.memberIds
|
allow update: if request.auth.uid == resource.data.creatorId
|
||||||
&& request.resource.data.diff(resource.data).affectedKeys()
|
&& request.resource.data.diff(resource.data)
|
||||||
.hasOnly(['name', 'about', 'contractIds', 'memberIds', 'anyoneCanJoin' ]);
|
.affectedKeys()
|
||||||
allow delete: if request.auth.uid == resource.data.creatorId;
|
.hasOnly(['name', 'about', 'contractIds', 'memberIds', 'anyoneCanJoin' ]);
|
||||||
|
allow update: if (request.auth.uid in resource.data.memberIds || resource.data.anyoneCanJoin)
|
||||||
|
&& request.resource.data.diff(resource.data)
|
||||||
|
.affectedKeys()
|
||||||
|
.hasOnly([ 'contractIds', 'memberIds' ]);
|
||||||
|
allow delete: if request.auth.uid == resource.data.creatorId;
|
||||||
|
|
||||||
function isMember() {
|
function isMember() {
|
||||||
return request.auth.uid in get(/databases/$(database)/documents/groups/$(groupId)).data.memberIds;
|
return request.auth.uid in get(/databases/$(database)/documents/groups/$(groupId)).data.memberIds;
|
||||||
}
|
}
|
||||||
|
match /comments/{commentId} {
|
||||||
match /comments/{commentId} {
|
allow read;
|
||||||
allow create: if request.auth != null && commentMatchesUser(request.auth.uid, request.resource.data) && isMember();
|
allow create: if request.auth != null && commentMatchesUser(request.auth.uid, request.resource.data) && isMember();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user