jmnda
Define custom AshAuthentication action for creaing a user
How can I define another action apart from register_with_password for creating users? My implementation here for the register_with_password(overrides the one from AshAuthentication) action accepts an organization argument as a map, this creates a user and an organization. Now I want define another action for creating organization users(like an admin adding users to an org), this action will accept an organization_id instead, since an organization already exists and am just relating it to a user. I have tried to duplicate the register_with_password with a different name like this:
create :register_internal_user do
allow_nil_input [:hashed_password]
accept [:email]
argument :password, :string do
sensitive? true
constraints min_length: 8, max_length: 32
end
argument :password_confirmation, :string do
sensitive? true
constraints min_length: 8, max_length: 32
end
argument :user_profile, :map, allow_nil?: false
argument :organization_id, :uuid, allow_nil?: false
validate AshAuthentication.Strategy.Password.PasswordConfirmationValidation
change AshAuthentication.Strategy.Password.HashPasswordChange
change AshAuthentication.GenerateTokenChange
change manage_relationship(:organization_id, :organization, type: :append_and_remove)
change manage_relationship(:user_profile, type: :direct_control)
end
action but am getting an error in the changeset:
...
errors: [
%Ash.Error.Framework.AssumptionFailed{
message: "Action does not correlate with an authentication strategy",
splode: nil,
bread_crumbs: [],
vars: [],
path: [],
stacktrace: #Splode.Stacktrace<>,
class: :framework
}
]
...
How can I implement this action?
Trending in Questions
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Hello !
We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










Marked As Solved
zachdaniel
Ah, right sorry about that. Try adding this to your action, above the other changes/validations:
Also Liked
jmnda
Thank you Zach, that worked.