Currently
allow read, write: if request.auth.uid != null && request.auth.token.admin == true
Is it okay to do smth like this?
allow read, write: if request.auth.token.admin == true
It's not necessary as trying to read the property token
of null
(if the user is not signed in) will just error out and reject the operation. You'll find many examples in the documentation that do not check request.auth != null
explicitly before request.auth.uid == '---'
or any role validation.
request.auth.uid != null
is redundant as token
will be defined only if the user is logged in and the role validation will pass if the user is an admin irrespective of the user ID.