Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Omkar Khandare
How assign Organization role through code.?
July 3, 2013 10:53 PM
Answer

Omkar Khandare

Rank: Junior Member

Posts: 40

Join Date: March 6, 2012

Recent Posts

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.
Apoorva Prakash
RE: How assign Organization role through code.?
July 3, 2013 11:14 PM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

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:
1long organizationsIds[] = new long[2];
2organizationsIds[0] = 11013;
3organizationsIds[0] = 11014;
4UserLocalServiceUtil.updateOrganizations(user.getUserId(), organizationIds);


HTH...

Thanks and Regards,
Apoorva Prakash
Sachin Dhus
RE: How assign Organization role through code.?
July 3, 2013 11:41 PM
Answer

Sachin Dhus

Rank: Junior Member

Posts: 40

Join Date: April 25, 2012

Recent Posts

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
1
2UserGroupRoleLocalServiceUtil.addUserGroupRoles(userIds, groupId, roleId)


Regards,
Sachin
Omkar Khandare
RE: How assign Organization role through code.?
July 3, 2013 11:52 PM
Answer

Omkar Khandare

Rank: Junior Member

Posts: 40

Join Date: March 6, 2012

Recent Posts

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.