Ash FrameworkAF
Ash Framework8mo ago
41 replies
Ege

Get user's role in given organization

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 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])
Was this page helpful?