Nhibernate 过滤树权限

发布于 2024-09-04 09:11:23 字数 430 浏览 2 评论 0原文

我正在尝试创建一个 HQL 查询,该查询将根据用户过滤树。

在树根上我有AllowUsers 和AllowRoles,在每个节点上我有DenyUsers 和DenyNodes。我可以使用过滤到树根上的用户

select e 
from oStructureMenu e 
  join fetch e.Nodes n 
where e.Id = :id 
  and :user in (select u from e.AllowUsers u)

,但是当我添加

and :user in (select f.DenyUsers from n f)

创建的sql时有语法错误

另外我不知道如何将用户的角色与允许或拒绝角色中的角色进行比较任何

帮助将不胜感激...

I am trying to create an HQL query that will filter a tree based on a user.

On the tree root i have AllowUsers and AllowRoles and on each node I have DenyUsers and DenyNodes. I can filter to on the user on the root of the tree using

select e 
from oStructureMenu e 
  join fetch e.Nodes n 
where e.Id = :id 
  and :user in (select u from e.AllowUsers u)

but when I add

and :user in (select f.DenyUsers from n f)

the sql created has a syntax error

Also I have no idea how I am going to compare the roles for the user to the roles in the allow or deny roles collections

Any help will be appreciated...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜妞爱困 2024-09-11 09:11:23

不应该是这样吗

and :user in (select f from n.DenyUsers f)

shouldn't it be

and :user in (select f from n.DenyUsers f)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文