I want to make a function to determine if a user, whose ID is passed with parameter, is an admin. I am able to do this for the currently logged in user with –
public static bool IsAuthorizedUser()
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
but I want to check any user passed in. So the signature would change to
public static bool IsAuthorizedUser(string username_to_check)
How can I do this? Any help is appreciated.
I was able to get it working how I wanted with UserPrincipal. Thanks for the all of the feedback.