IDがパラメータとともに渡されたユーザーが管理者であるかどうかを判別する関数を作成したいと思います。私は現在ログインしているユーザーに対してこれを行うことができます-
public static bool IsAuthorizedUser()
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
ただし、渡されたユーザーを確認したいので、署名は次のように変更されます。
public static bool IsAuthorizedUser(string username_to_check)
これどうやってするの?どんな助けでも大歓迎です。