Re: Code access security....
From: Joe Kaplan (ilearnedthisthehardway_at_noway.com)
Date: 05/09/03
- Next message: Shel Blauman [MSFT]: "Re: Asserted permissions and ASP.NET pages"
- Previous message: Ollie Riches: "Re: Code access security...."
- In reply to: Ollie Riches: "Re: Code access security...."
- Next in thread: Calvin Walker: "Re: Code access security...."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 9 May 2003 09:32:28 -0500
Check out the PrincipalPermissionAttribute. That will allow you to do these
type of role checks declaratively. If the underlying IPrincipal on the
thread is a WindowsPrincipal class that pertains to a security principal in
your Active Directory domain, then the role checks will go against their AD
groups (using the WinNT account name style domain\group samAccountName).
Hope that helps.
Joe K.
"Ollie Riches" <ollie_riches@REMOVE_MEhotmail.com> wrote in message
news:O74VAMjFDHA.2204@TK2MSFTNGP10.phx.gbl...
> sorry meant Roles not groups.....
>
> I know I can check whether a user is a member of Role by using
>
> WindowsPrincipal MyPrincipal = (Thread.CurrentPrincipal as
> WindowsPrincipal);
> if (MyPrincipal.IsInRole("Administrator")) {
> // Permit access to some code.
> }
>
> but is there anyway I can do this with an attribute on the method\class
> that will throw a security exception attempting to access said
functionality
>
> Cheers
>
> Ollie
>
>
>
> "Ollie Riches" <ollie_riches@REMOVE_MEhotmail.com> wrote in message
> news:eIN1SHjFDHA.1820@TK2MSFTNGP12.phx.gbl...
> > I have several custom groups defined in my AD(active directory) and
> certain
> > users are members of certain groups how do I prevent declaratively in
the
> C#
> > code users from accessing certain classes and\or methods on classes?
> >
> > Cheers
> >
> > Ollie
> >
> >
>
>
- Next message: Shel Blauman [MSFT]: "Re: Asserted permissions and ASP.NET pages"
- Previous message: Ollie Riches: "Re: Code access security...."
- In reply to: Ollie Riches: "Re: Code access security...."
- Next in thread: Calvin Walker: "Re: Code access security...."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]