Forums de discussion

How assign Organization role through code.?

thumbnail
Omkar Khandare, modifié il y a 10 années.

How assign Organization role through code.?

Junior Member Publications: 49 Date d'inscription: 07/03/12 Publications récentes
Currenlty i am using liferay 6.1 CE
I have customized registration using EXT plugin,
Now i want to assign users to an organization & assign an organization role to same users.

Now i need to know which API can be used to assign specific Organization role to User.

How we can achieve it.?

Please Help.
thumbnail
Apoorva Prakash, modifié il y a 10 années.

RE: How assign Organization role through code.?

Liferay Master Publications: 658 Date d'inscription: 15/06/10 Publications récentes
Omkar Khandare:
Currenlty i am using liferay 6.1 CE
I have customized registration using EXT plugin,
Now i want to assign users to an organization & assign an organization role to same users.

Now i need to know which API can be used to assign specific Organization role to User.

How we can achieve it.?

Please Help.


Hi Omkar,

Hope the following code can help you:
long organizationsIds[] = new long[2];
organizationsIds[0] = 11013;
organizationsIds[0] = 11014;
UserLocalServiceUtil.updateOrganizations(user.getUserId(), organizationIds);


HTH...

Thanks and Regards,
Apoorva Prakash
thumbnail
Sachin Dhus, modifié il y a 10 années.

RE: How assign Organization role through code.?

Junior Member Publications: 40 Date d'inscription: 25/04/12 Publications récentes
Omkar Khandare:
Currenlty i am using liferay 6.1 CE
I have customized registration using EXT plugin,
Now i want to assign users to an organization & assign an organization role to same users.

Now i need to know which API can be used to assign specific Organization role to User.

How we can achieve it.?

Please Help.


Hi Omkar,
Try this

UserGroupRoleLocalServiceUtil.addUserGroupRoles(userIds, groupId, roleId)


Regards,
Sachin
thumbnail
Omkar Khandare, modifié il y a 10 années.

RE: How assign Organization role through code.?

Junior Member Publications: 49 Date d'inscription: 07/03/12 Publications récentes
I used UserGroupRoleLocalServiceUtil.addUserGroupRoles(userIds, groupId, roleId)
previously for assigning site role of Guest group.

Yeah i will try with the same,
hope it will work for Organization also.

Thanks.