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


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
>
>
>
>
>



Relevant Pages

  • Getting a list of Roles a user belongs to using Windows Security Principal
    ... I have created a windows application in .NET using C# here is the Code ... public static void Main{ ... As you can see I can determine if the current user belongs to Adminstartor, ... Moreover what is the String equivalent of WindowsBuiltInRole.Administrator ...
    (microsoft.public.dotnet.security)
  • RE: Which Groups and what are effective permissions based on multiple groups?
    ... You can use xp_logininfo to get the group name which the user belongs to. ... if you have a Windows user John who belongs to the Windows ... For example, run the following command: ...
    (microsoft.public.sqlserver.server)
  • Script to dump Local User "Group Membership" to a file.
    ... All I need is a script that ... can parse all Local Users and dump the username as well ... as what groups that user belongs to. ... Again this is Local Security on a Windows 2000 Svr. ...
    (microsoft.public.win2000.general)
  • Re: Script to dump Local User "Group Membership" to a file.
    ... I have a Windows 2000 Server that is a document ... All I need is a script that ... | can parse all Local Users and dump the username as well ... | as what groups that user belongs to. ...
    (microsoft.public.win2000.general)
  • Re: Whether Logged on User has Administrator Privilages or not
    ... The thing to keep in mind that being an adminitrator isn't an either or thing ... Joe Richards Microsoft MVP Windows Server Directory Services ... > Is there are any APIs in Active Directory that provides functionalities to ... > And the APIs to find out groups to which user belongs,in windows 2000 or ...
    (microsoft.public.win2000.active_directory)