Users belong to multiple organizations. In some orgs they are regular users and in others they are admins.
I need to add something to the User resource that takes an organization ID and returns the user's role in that organization. What would that thing be? A read action? A calculation?
There's an existing calculation called
organization_hierarchy
organization_hierarchy
that let's me get a list of organizations the user is a member of, e.g.
user = Ash.load!(changeset.data, organization_hierarchy: [id: changeset.data.id, format: :list])
user = Ash.load!(changeset.data, organization_hierarchy: [id: changeset.data.id, format: :list])
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.