I have an MVC application which has the (simplified) structure as below (left-to-right)
UI -> CONTROLLERS -> SERVICES -> REPOSITORIES -> DATABASE
We've attempted to keep each layer decoupled from the next. We're using .NET Membership to manage security, and we have a permissions based function, let's say "Show me all documents for my user type".
Should:
The Services layer have no awareness of our .NET Membership provider? We'd then have Service layer methods which looked like "GetDocumentsByUserType(int UserTypeId){ .. }"?
The GetDocumentsByUserType() method be aware that we're using .NET Membership, use Membership methods to get the current user type, and return the relevant documents?
Also:
- Does #1 make my Services layer less secure, as my controller layer
could pass in anything it wanted as a UserType? - Does #2 make my Services layer too dependent on a specific technology, namely .NET
Membership? Is there another way to consider here?
Hope I've provided enough details. Please shout if not and I'll add.
Thanks.