I presume this is a pretty common problem but I can never decide the best way to do it.
Simple system. It has users, users can be a assigned a role. Roles are defined by the admin users.
The situation arises where an admin wants to delete a role from the system which is still in use. I don't want to delete the role and leave the users without role so I'm firing back a message saying
"role (x) cannot be deleted as it is still in use"
However this isn't very helpful as the admin then has to go figure out which users have this role and assign them a new role, then go back and delete it.
Does anybody have any better mechanisms for this kind of functionality?