Re: Getting a list of Roles a user belongs to using Windows Security Principal
From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 11/19/03
- Next message: steve: "CoInitializeSecurity"
- Previous message: Joe Kaplan \(MVP - ADSI\): "Re: LookupAccountSid does make a call to domain controller"
- In reply to: vivek: "Getting a list of Roles a user belongs to using Windows Security Principal"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 18 Nov 2003 23:47:58 -0600
This may help. It shows you how to call the internal _GetRoles method via
reflection. Note that you should not use this in production, only for
experimentation!
http://groups.google.com/groups?selm=uRRZz3wgDHA.524%40tk2msftngp13.phx.gbl&oe=UTF-8&output=gplain
Joe K.
"vivek" <vivek@viswanathan78.freeserve.co.uk> wrote in message
news:bpdqes$32a$2@news6.svr.pol.co.uk...
> 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
>
>
>
>
>
- Next message: steve: "CoInitializeSecurity"
- Previous message: Joe Kaplan \(MVP - ADSI\): "Re: LookupAccountSid does make a call to domain controller"
- In reply to: vivek: "Getting a list of Roles a user belongs to using Windows Security Principal"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|