Seed Data - Roles and Default Assignment closes #365 #368

Merged
moritz merged 16 commits from feature/365_seed_roles into main 2026-01-25 17:21:04 +01:00
Showing only changes of commit a9b1d794d2 - Show all commits

View file

@ -166,8 +166,11 @@ role_configs = [
# Create or update each role # Create or update each role
Enum.each(role_configs, fn role_data -> Enum.each(role_configs, fn role_data ->
# Bind role name to variable to avoid issues with ^ pinning in macros
role_name = role_data.name
case Mv.Authorization.Role case Mv.Authorization.Role
|> Ash.Query.filter(name == ^role_data.name) |> Ash.Query.filter(name == ^role_name)
|> Ash.read_one(authorize?: false, domain: Mv.Authorization) do |> Ash.read_one(authorize?: false, domain: Mv.Authorization) do
{:ok, existing_role} when not is_nil(existing_role) -> {:ok, existing_role} when not is_nil(existing_role) ->
# Role exists - update if needed (preserve is_system_role) # Role exists - update if needed (preserve is_system_role)