AI OnAI Off
Writing this without any morning coffee - assuming you are using aspnet identity, you can use UserManager.Users to get all users. then for each user, use user.IsInRole to check if they are administrator
if you have many users, performance should be a consideration
I'm looking to grab the entire list of users who are not administrators and deactivate them.
I've found a way to do it, but it's not elegant and feels very hacky. I'm writing it as a Scheduled Job:
The only function I could find to grab all users was the GetAllUsersAsync... which is async and needed wrapping in order to use it from my non-async function.
Does anyone have a better way to do this?
Cheers,
Lance