How to specify actor in AshAdmin?
I'd like to use it to (temporarily during development) trigger some actions, but the actions have policies limiting to the relevant user. I don't mind that, I don't need access to EVERYTHING in the admin. But what is the intended way for me to set my actor correctly?
Solution:Jump to solution
You can designate some resources as
actor resources
```elixir
admin do
actor? true
end...17 Replies
by default it doesn't run authorization AFAIK so policies shouldn't prevent you from doing things in AshAdmin
Solution
You can designate some resources as
actor resources
and you can then go log in as those usersby navigating to them and clicking the key icon
I see, that makes sense. I assumed that was the problem, but what's actually happening is I fill in my form for adding a new resource, a create action. And when it comes to the text field for user_id, i copy / paste the uuid from the database into the field.
Then the user_id is rejected on submit.
Not really following sorry
It's ok, I'm just not understanding why it isn't letting me paste in a UUID for the user_id field in an admin form. It's the form refreshes, shows an error saying "user_id is required", but all other data validates correctly.
Sorry, I just don't think I really understand what you're saying yet. Are you saying copy/pasting isn't working? There is no field for it?
Here's the form before.

Here's when I submit it.

what happens if you like backspace the last letter and then type it back in?
Just trying to see if it something weird with the form state or what
Also does the action itself do anything to manipulate
user_id in some way?
does it, for instance, use relate_actor to connect the current user to the thing being created?user_id is required to user_id is invalid
that is setting
user_id to nil
because there is no actorah hah
change set_attribute(:user_id, ^arg(:user_id))
probably something more like this
then again, i can just remove thatis this meant to only be done in admin?
or what is this action actually used for in real life?
no, it's done through user-led oauth
So the alternative would be for you to do the actor configuration I mentioned above
click into that actor and authenticate as them
and then call that action
Oh I see, I understand that comment now
Great it works, thanks.