Re: creating a _simple_ fine grained user based security system
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
I'd create an interface, something like this
IUserPermissionService
{
bool CanCreateReservations(User user);
bool CanEditReservation(User user, Reservation reservation);
etc
}
I'd then create a class that implements this and register it in a class that
implements IServiceProvider. If you make sure the instance of
IServiceProvider is always available then any layer of your app can access
stuff via interfaces in a loosely coupled way. Another benefit of this is
that when you write your unit tests you can create a mock
IUserPermissionService and register it in the service provider in order to
control the outcome of the test.
Pete
.
Relevant Pages
- Re: Factory method question
... and rather to an interface or abstract class. ... my suggestion means you'd be programming to concrete classes. ... bool IsMatch; ... database with a unique ... (microsoft.public.dotnet.languages.csharp) - Re: Question about data layer
... Here is a ModelBase interface that alloows you to do that even over SOAP. ... TModelType UnderlyingValues ... bool IsNew; ... You DAL calls populate after it has populated the ... (microsoft.public.dotnet.languages.csharp) - Re: Role Based Security
... I decided to go to a RIGHTS based model. ... The below interface has met my needs, ... bool IsInAnyRole; ... ISecurityRoleCollection AllRoles //and ISecurityRole is just a Guid ... (microsoft.public.dotnet.framework) - Exposing .NET Events in COM
... I have developed a C++ class that implements the source interface my .NET class exposes for events ... I Instantiate the event sink succesfully. ... bool ProcessOutgoingTransaction; ... Then I used COM in my Visual C++(Dialog based application to use the NET OBJECT: ... (microsoft.public.dotnet.framework.interop) - Exposing .NET Events in COM
... I have developed a C++ class that implements the source interface my .NET class exposes for events ... I Instantiate the event sink succesfully. ... bool ProcessOutgoingTransaction; ... Then I used COM in my Visual C++(Dialog based application to use the NET OBJECT: ... (microsoft.public.dotnet.framework.interop) |
|