以非管理员角色通过 JBoss 访问用户列表?

发布于 2024-08-05 20:21:12 字数 168 浏览 3 评论 0原文

我们希望在类似于 UsersPortlet 的管理版本的 portlet 中提供可用的用户列表,但适用于那些不是管理员的用户。这个列表只是名字。有没有办法通过 JBoss GA 4.2.2 做到这一点?我们目前正在 Hypersonic DB 上进行开发,但我希望有一种独立于 DB 的方式通过 JBoss 来完成此任务。

We would like to make a list of users available in a portlet similar to the admin version of the UsersPortlet, but for those that aren't admins. This list would be names only. Is there a way to do this through JBoss GA 4.2.2? We are currently developing on the Hypersonic DB, but I would hope there is a DB independent way to do this through JBoss.

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

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

发布评论

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

评论(1

套路撩心 2024-08-12 20:21:12

我们找到了 Identity Manager 及其关联类。使用默认配置源代码可以是:

import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.UserProfileModule;

[...]

(UserModule)new InitialContext().lookup("java:portal/UserModule");
RoleModule rm = (RoleModule)new InitialContext().lookup("java:portal/RoleModule");
(MembershipModule)new InitialContext().lookup("java:portal/MembershipModule");
(UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");

rm.findRoles()

我们遇到的一个关键问题是,要正确填充 InitialContext,这必须发生在事务中。这意味着如果您使用 RichFaces,则这不能在底层 bean 中发生。

We found the Identity Manager and its associated classes. Using the default configurations source code can be:

import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.UserProfileModule;

[...]

(UserModule)new InitialContext().lookup("java:portal/UserModule");
RoleModule rm = (RoleModule)new InitialContext().lookup("java:portal/RoleModule");
(MembershipModule)new InitialContext().lookup("java:portal/MembershipModule");
(UserProfileModule)new InitialContext().lookup("java:portal/UserProfileModule");

rm.findRoles()

A critical gotcha that got us is that for the InitialContext to be properly populated this must occur in a transaction. That means if you are using RichFaces this can't take place in the underlying beans.

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