如何在实体框架上应用默认过滤器
我有一个实体数据模型(User、SecurityProfile 和 OrganizationalUnit 作为实体)。 User 和 OrganizationalUnit 之间存在 1:1 连接,SecurityProfile 和 OrganizationalUnit 之间存在 n:n 连接,User 和 SecurityProfile 之间存在 1:0 连接。
基本上我们有用户,很少有用户具有管理权限(SecurityProfiles)。一名管理员可以管理一个或多个组织单位及其下的所有用户。
当我访问entity.OrganizationalUnits时,有什么方法可以通过安全逻辑自动过滤返回的集合吗?这是一个 MVC2 项目,所以我总是可以检索当前的身份和角色,而且逻辑也可用,这将使过滤我只是不知道如何以及在哪里插入以自动应用它。这在技术上有可能吗?
提前致谢
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 just don't know how and where to insert to automatically apply it. Is it techically possible at all?
thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论