Getting a list of Roles a user belongs to using Windows Security Principal

V

vivek

Hi

I have created a windows application in .NET using C# here is the Code
Snipp

public static void Main() {
...
// Tell the CLR to use Windows security
AppDomain.CurrentDomain.SetPrincipalPolicy(
PrincipalPolicy.WindowsPrincipal);
// Get the current principal object
WindowsPrincipal prin =
(WindowsPrincipal) Thread.CurrentPrincipal;
// Determine whether the user is an admin
Boolean fAdmin = prin.IsInRole(WindowsBuiltInRole.Administrator);
Console.WriteLine("Administrator:" + fAdmin);
}

As you can see I can determine if the current user belongs to Adminstartor,
but is there a method
where I can get the list of Roles that a particualr use belongs to.

Moreover what is the String equivalent of WindowsBuiltInRole.Administrator
so that I can use that
string in the method

WindowsPrincipal.IsInRole(String);


voeivk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top