How would you give a user multiple roles or multiple permissions?
I want a user to be able to switch between multiple roles (e.g., admin, editor, user), but I want to select which roles the user is allowed to switch to. Some users can only be user and some can switch between editor and user.
In the checkbox example, you user attribute :categories, {:array, :string}
.
If I have a Role enum, can I do attribute :allowed_roles, {:array, Tunez.Accounts.Role}
and Ash will check if the values are one of the enum values?
defmodule Tunez.Accounts.Role do
use Ash.Type.Enum, values: [:admin, :editor, :user]
end