We have some custom code to send emails out when submitting an item from one workflow state to another and it seems to be sending items to users who have been disabled. I've been trying to find a way to check on the enabled/disabled status of a user, but haven't had much luck. Here is the code:
public class UserFunctions
{
public static List<User> ContentAdminsFor(Item i)
{
if (i == null) return null;
var users = new List<User>();
var contentAdmins = RolesInRolesManager.GetUsersInRole(Role.FromName(@"org\Workflow Admin"), true);
var orgRoot = Utils.GetRoot(i);
foreach(var user in contentAdmins)
{
using (new UserSwitcher(user))
{
if (orgRoot.Access.CanWrite())
{
users.Add(user);
}
}
}
return users;
}
}