liferay 按角色启用组织或社区
我正在开发一个新的 liferay 实现。我的所有用户都在外部系统中,并且使用了外部环境。通过我自己的身份验证系统进行身份验证。我还将角色存储在同一个系统中。我已经能够成功地将这些传递给 liferay,以便我的所有用户角色都可以在 liferay 中使用。
我想创建一个与角色关联的组织或社区。例如,如果我在外部系统中有一个名为“myusers”的角色,我想将该角色与 liferay 中的组织或社区联系起来。然后,当用户以该角色登录 liferay 时,他们将能够成为该组织或社区的一部分。这在liferay中可能吗?我知道这有点倒退到 liferay 中向用户添加角色,然后将用户添加到社区或组织的正常流程。
I am working on a new liferay implementation. I have all of my users in an external system, and have used the external env. to authenticate through my own authentication system. I also store roles in this same system. I have been able to successfully pass these to liferay so that all of my users roles are available in liferay.
I would like to create an organization or community that is associated with a role. For example if I have a role called 'myusers' in my external system, I would like to tie that role to an organization or community in liferay. Then when a user logged in to liferay with that role, they would be able to be part of that organization or community. Is this possible in liferay? I know it's kind of backwards to the normal flow in liferay of adding roles to users and then adding user to a community or organization.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以修改以下代码来检查用户是否属于某个角色,然后将其添加到适当的组织。
要将用户添加到所有组织:
You can modify the below code to check if the user belongs to a role and then add him to the appropriate organization.
To add a user to all Organizations:
我最终做的是使用 liferay 内置的 Expando 功能。通过这样做,我允许输入应映射到该组织的角色列表。这使我能够在用户登录时查看他们的角色,并确定他们应该成为哪些组织的成员。然后,我根据 Expando 属性中定义的角色以及分配给用户的角色,以编程方式在组织中添加/删除用户。
What I ended up doing was using the expando functionality built into liferay. Doing this I allow for entering a list of roles that should map to that organization. This allows me to look at the roles of my users when they login and determine what organizations they should be a member of. I then programatically add/remove the users from the organizations based upon the roles defined in the expando attribute and the roles assigned to the user.