Search code examples
javascriptfirebaseaclgoogle-cloud-firestore

Firestore transaction / permission management for create


I'm starting a new firebase project using firestore.

I'd like users to be able to create a new node under an "organizations" table, and then add user ID and orgid to a orgAdmin table.

The idea is that i can manage user membership and organization ownership.

My problem is that I don't quite understand how to manage permissions for this in a client side app.

Maybe I need a cloud function for after org creation?

Rules:

When a user creates an organization they are added to the admin join table.

Only admins can add other admins to an organization.


Solution

  • Ended up going with a cloud function that responds to organization creation, adds the creator to join table. Pretty painless first forray into cloud functions!