Currently, my app utilizes Firebase in conjunction with react native. Users are able to share content with different permissions - read, copy, or modify, and can do so with specific users or all users. Due to the fact that Firebase lacks an OR function for queries, I have resorted to using an array to store user:permission combinations. This enables me to utilize the array-contains-any capability for querying purposes as shown below:
.where("access", "array-contains-any", [user_id, `${user_id}:R`, `${user_id}:C`, `${user_id}:M`, "All_R", "All_C", "All_M"])
This method facilitates querying of content owned by a particular user, shared to that user, or shared with all users, while considering R, C, or M permissions.
My next objective is to implement a similar approach for authentication rules, ensuring that only users with "M" permission can perform modifications, etc. This will involve comparing the authenticated user ID to the user IDs stored in the array. Ideally, a feature akin to "array-contains-any" and string concatenation would be required for authentication rules.
Is this achievable within Firebase's capabilities, or should I explore alternative strategies?