So it seems like I’m spamming the forums of late. Sorry about that, there are a few things I’m trying to figure out.
I’m using ash_authentication_phoenix and I’ve got that working pretty much the way I want it now. I have a user resource with username (not email), password and a few other fields such as role. I’m not using tokens at all. Users cannot register themselves. Instead they need to be created by a user who has the admin role.
Now I need a administrator to be able to perform basic CRUD operations on users. This shouldn’t be complicated, but I’m a bit stumped on some of the operations and was hoping I could get a little help along the way to figure it out.
I’ve tried looking for something like an ash_user_management module that would tie in with the authentication one, but I haven’t found one at least. If anybody has developed one or is working on one, please do let me know. I thought this would be a common enough situtation that somebody would have developed something, but maybe the world has moved away from writing business applications?
I’ve got list and details views worked out already, that didn’t present any problem. I suppose I can use register to create a user, even though there will be an active user session, right? That seems to make a lot of sense. I can’t imagine delete would present any problem. But I’m not sure how to deal with update user, since it will be given a password that should be converted to a hashed one. Is that what :register_with_password does? I’m looking through the sources but seem to be a bit lost. Can I use :register_with_password along with the update action or do I have to write a custom action for it?
Now I may just be really tired and my mind is running around in circles, but I began to think about an alternative, but I don’t suppose two resources could share the same database table, right? Because authentication and user management are clearly two very different activities, just that they happen to use the same underlying data. The idea that came to me was if I’m meant to have on user recource for auth and another one for user management? Somehow that also doesn’t quite sound right though.