in addition to what Tom said, with IsInRole , you must know the group name,
as there's no mechanism to retrieve all the group to which a user belongs.
you can use reflection to retrieve the list of all the groups a user belongs
to, but it should not be used in production app since it require elevated
previleges (bcoz of Reflection). Anyway it's a cool way to retrieve the
exact name of all the groups...
----- C# code ----
System.Security.Principal.WindowsIdentity WI =
System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal WP = new
System.Security.Principal.WindowsPrincipal(WI);
Type TT = WP.GetType();
FieldInfo PI = TT.GetField( "m_roles",BindingFlags.NonPublic |
BindingFlags.Instance );
string[] ROLES = (string[])PI.GetValue(WP);
string AllRoles="";
foreach (string Role in ROLES)
{
AllRoles +=Role + "\n";
}
MessageBox.Show( AllRoles);
-----
hope it helps
[quoted text, click to view] "Tom Vande Stouwe MCSD.net" <tomv@conpro.net> wrote in message
news:e9IcL7gUDHA.2204@TK2MSFTNGP10.phx.gbl...
> What you can get is the Groups that the user is in with theUser.IsInRole.
> You will need to know what permission the groups have, but that is all
that
> is available to the IDE
>
> Tom
>
> --
> ==========================================
> = Tom Vande Stouwe MCSD.net, MCAD.net, MCP
> = 45Wallstreet.com (
www.45wallstreet.com)
> = (803)-345-5001
> ==========================================
> = If you are not making any mistakes
> .= ..you are not trying hard enough.
> ==========================================
> "MJB" <mb2@email.com> wrote in message
> news:%23354xzgUDHA.1692@TK2MSFTNGP11.phx.gbl...
> > I know I can get the current username through the System.Environment
> class,
> > but I can't seem to find where I can retrieve the user's role /
permission
> > level (i.e. Admin, power user, etc).
> >
> > If anyone has done this and can shed some light on the issue I would
> > appreciate it.
> >
> > TIA,
> > Matt
> >
> >
>
>