lib/step_flow/controllers/right_definition_controller.ex
defmodule StepFlow.RightDefinitionController do
use StepFlow, :controller
alias StepFlow.Rights.Right
action_fallback(ExBackendWeb.FallbackController)
def index(conn, _params) do
rights =
Right.RightEnum.__valid_values__()
|> Enum.filter(fn value -> is_bitstring(value) end)
endpoints =
Right.EndpointEnum.__valid_values__()
|> Enum.filter(fn value -> is_bitstring(value) end)
conn
|> put_view(StepFlow.RightDefinitionView)
|> render("right_definition.json", right_definition: %{rights: rights, endpoints: endpoints})
end
end