Complete the code to define a user role in Firebase rules.
match /users/{userId} {
allow read: if request.auth.token.role == [1];
}The role "admin" is used here to allow read access only to admin users.
Complete the code to check if the user has the editor role.
allow write: if request.auth.token.role == [1];
The write permission is granted only if the user's role is "editor".
Fix the error in the role check to allow only admins to delete.
allow delete: if request.auth.token.role == [1];
The equality check must use '==' instead of '=' to compare roles.
Fill both blanks to allow read for admins and editors only.
allow read: if request.auth.token.role == [1] || request.auth.token.role == [2];
This rule allows read access if the user role is either "admin" or "editor".
Fill all three blanks to allow write only if user is admin and the document owner.
allow write: if request.auth.token.role == [1] && resource.data.ownerId == [2] && request.auth.uid == [3];
This rule ensures that only admins who own the document can write to it.
