File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -175,11 +175,19 @@ rules_version = '2';
175175service cloud .firestore {
176176 match / databases/ {database}/ documents {
177177 match / {collection}/ {document }/ {path= ** } {
178- allow read: if isPublic (collection, document ) || isAdmin ( );
179- allow write: if registrationEnabled (collection) || isAdmin () || ( isEditor () && isPublic (collection , document ) );
178+ allow read: if canRead (collection, document );
179+ allow write: if canWrite (collection, document );
180180 }
181- function isPublic (collection , document ) {
182- return collection != ' config' && (collection != ' users' || isOwner (document ));
181+ function canRead (collection , document ) {
182+ return isAccessible (collection, document ) || isAdmin ();
183+ }
184+ function canWrite (collection , document ) {
185+ return registrationEnabled (collection) || isAdmin () || (
186+ isEditor () && collection != ' config' && isAccessible (collection, document )
187+ );
188+ }
189+ function isAccessible (collection , document ) {
190+ return collection != ' users' || isOwner (document );
183191 }
184192 function isSignedIn () {
185193 return request .auth != null ;
You can’t perform that action at this time.
0 commit comments