留言板

update organization role from site memberships

Martin ALFONSI,修改在8 年前。

update organization role from site memberships

New Member 帖子: 9 加入日期: 15-6-23 最近的帖子
Hi there,

I'm new to Liferay and I have to update a site done on Liferay 6.1.1.

On this site, each organization have a site with a portlet to display and edit the organization informations. The user who create the organization and site is owner of both, so he can edit without problem. But on the liferay "manage site memberships" window, if he add new member and give them "site owner" or "site admin" role, they won't be able to edit because they are not "organization owner" or "organization admin".

I would like to know if it's possible to add a function so when the site's role is changed, the equivalent organization's role is also changed.
thumbnail
Jesse Rao,修改在8 年前。

RE: update organization role from site memberships

Junior Member 帖子: 58 加入日期: 10-7-12 最近的帖子
Hi Martin,

For organizations with attached sites, site roles are automatically assigned to members of the organization based on their organization roles.

For example, suppose you created an Organization called Employees with an attached site. Then if you select Employees in the Control Panel and click on Site Memberships, you'll see a message like this:


This site belongs to Employees which is an organization of type Regular Organization. All users of Employees are automatically members of the site and site roles are automatically assigned to them based on the organization roles they have in Employees as shown in the table below.


This means that if a user has an organization role, he's automatically assigned corresponding site roles. But this doesn't work the other way: assigning site roles does not grant any organization roles.

So it sounds like when you're adding new organization members, you should grant them organization admin or owner roles and not site admin or owner roles.
Martin ALFONSI,修改在8 年前。

RE: update organization role from site memberships

New Member 帖子: 9 加入日期: 15-6-23 最近的帖子
Thanks for your help. I understand that I have to put role to organization, not site.

The fact is that our users are using the "site memberships" popup, in the manage menu. And it looks like it only interract with the site... Indeed, when I add a member to the site, he is not add to the organization...

I found how to do it from the control panel, but we are trying to make our platform as simple as possible, and this manage menu was usefull for that...
Do you know if it is possible to configure it so it assign member/role to organization rather than site ?

*edit*
I also notice that from the control panel, when an owner try to assign new member to his organization, all platform member are visible as expected, but all checkbox are disable so he can't add anyone... the only way to add someone is to be a platform admin (turn all into platform admin is of course not an option)... then assign member from either the organization or the member.
thumbnail
Jesse Rao,修改在8 年前。

RE: update organization role from site memberships

Junior Member 帖子: 58 加入日期: 10-7-12 最近的帖子
An organization owner/admin can manage all of the users in his organization. However, he can't add portal users to his organization - that's the job of a portal administrator.

Sorry, but it sounds like managing site memberships will not suffice for your use case.

If you need to do something like add all site members of a certain site to a certain organization, you could use Liferay's API to write a script to do that. And execute it from Liferay's script console (after careful testing, of course).
thumbnail
Jan Geißler,修改在8 年前。

RE: update organization role from site memberships

Liferay Master 帖子: 735 加入日期: 11-7-5 最近的帖子
Martin ALFONSI:
I would like to know if it's possible to add a function so when the site's role is changed, the equivalent organization's role is also changed.

I could imagine something like this:
Create a Liferay Plugin with a dummy portlet, which you basically hide by putting it in the hidden category in liferay-portlet-display.xml and by not exposing it as a Control Panel portlet.

In this portlet you create a ModelListener to the User Model. In the model listener there are the methods:

public void onAfterRemoveAssociation(  Object classPK, String associationClassName, Object associationClassPK) throws ModelListenerException;

And
public void onAfterAddAssociation(Object classPK, String associationClassName,Object associationClassPK) throws ModelListenerException;


Maybe you could check in here if the asssociated Class is a role in a site, and if the site is associated with an Organization you could try to change the Organization Role as well.

Don't know if this is feasible or not, (and here comes the omnipresent) BUT:
You need to have some kind of mapping, which SiteRoles correspond to which OrganizationRoles as there might be custom roles for a site or an organization which might not have the same name in in both scopes. You should be really - and be the word "really" I mean thorough - testing your method. A lot. As you might brake some stuff...

Edit:
One more thing:
When you try to update the role of the organization, you could get into troubles with permissions. As the user triggering the role change might not have the permission to do so in the organization.