Skip to content

Commit

Permalink
Update security rule
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-amisha-i committed Jan 7, 2025
1 parent 8338ef7 commit 23a16b0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions firestore.rules
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ service cloud.firestore {
resource.data.members.hasAny([request.auth.uid]);

allow create: if isAuthorized() &&
isCurrentUser(request.resource.data.created_by);
isCurrentUser(request.resource.data.created_by);

allow update: if isAuthorized() &&
(resource.data.members.hasAny([request.auth.uid]) ||
(!resource.data.members.hasAny([request.auth.uid]) &&
request.resource.data.diff(resource.data).affectedKeys().hasOnly(["members"])
)
);
(resource.data.members.hasAny([request.auth.uid]) ||
(!resource.data.members.hasAny([request.auth.uid]) &&
request.resource.data.diff(resource.data).affectedKeys().hasOnly(["members"])
)
)
|| request.resource.data.keys().hasAny(["updated_at", "updated_by"]);

allow delete: if isAuthorized() &&
resource.data.members.hasAny([request.auth.uid]);
Expand Down

0 comments on commit 23a16b0

Please sign in to comment.