How to apply a default filter on Entity Framework
I have an entity data model (User, SecurityProfile and OrganizationalUnit as entities). There is 1:1 connection between User and OrganizationalUnit, n:n connection between SecurityProfile and OrganizationalUnit and 1:0 connection between User and SecurityProfile.
Basically we have users, few users have administrative privileges (SecurityProfiles). One administrator can administer one or more organizational units and all of the users under this.
Is there any way that when I access entity.OrganizationalUnits than the returning set would be automatically filtered by a security logic? It is a MVC2 project, so I can always retrieve the current identity and the roles and also the logic is available that would make the filtering I ju开发者_如何学JAVAst don't know how and where to insert to automatically apply it. Is it techically possible at all?
thanks in advance
精彩评论