By "security" I mean data access rights, for example:
- Andrew only has read-only access to clients in France
- Brian can update clients in France and Germany
- Charles is an administrator, he has read and update rights for everything
I can see potential arguments for each layer.
Data Access Layer
The DAL only exposes clients to which the user has access, and passes an appropriate error up to the business layer when the user tries to do something unauthorised.
This simplifies the upper layers, and can reduce the data traffic for users who only have access to a small fraction of the data.
Business Layer
Because this is where the business logic resides and only the business layer has the complete knowledge of how the security should be implemented.
UI Layer
A tangent argument is because the UI layer is the one that deals with authentication. A stronger argument is when the application has non-UI functions: calculating the daily P&L, archiving, etc. These programs don't have a security context and creating a fictitious 'system' user is a maintenance nightmare.
A separate layer?
Slotted somewhere inside the 3?
I'm looking for a cogent argument which will convince me that layer X is the best for large-scale 3-Tier applications. Please refrain from 'it depends' answers ;-).
Thanks.