I want to fetch all users from the same company as the logged in user.
With getUsersFromCompany(this.userData.company) I do only get the user itself and nobody else.
When changing manually to another Company-ID (which is not the same ID as this.userData.company) all users are loading: getUsersFromCompany('anotherCompanyID)
getUsersFromCompany(company) {
return this.afs.collection('users', ref => ref.where('company', '==', company))
.valueChanges({ idField: 'uid' }).pipe(take(1)) as Observable<UserData>
}
It seems to block all users when the company ID is the same, but why/how?
My firebase security rules for testing are set to
match /users/{userId} {
allow read: if request.auth != null
}
Persistance was on, is now off
After a lot of testing around it stayed really confussing. But it seemed to have something to do with angularfire...
Solution for me: Switching from
to