Suppose there are two documents that
/orgs/foo /users/alice
and /users/alice has a field of reference type org that refers to /orgs/foo .
/orgs/foo should be available if request.auth.uid == 'alice' . How can i do this?
I think this is something like this, but I cannot understand. In other words, how can I get the id of the referenced document?
function isOrgMember(orgId) { return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.org.__id__ == orgId; } match /orgs/{orgId} { allow read: isOrgMember(orgId); }
source share