Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Lukas Barina
API to change existing site member role from site member to site admin
February 27, 2013 4:16 AM

Lukas Barina

Rank: New Member

Posts: 8

Join Date: June 7, 2012

Recent Posts

anybody who knows the API to change site members roles ???

I have a concreate site with bunch of users as site members
I need to make a concreate user to be a site admin programatically

I tried following code but no luck:
Role role = RoleLocalServiceUtil.getRole(themeDisplay.getCompanyId(), "Site Admin");
long[] roleIds = new long[] { role.getRoleId() };
long[] groupIds = new long[] { mySite.getGroupId() };

// GroupLocalServiceUtil.addRoleGroups(role.getRoleId(), groupIds); ??
UserGroupRoleLocalServiceUtil.addUserGroupRoles(adminUser.getUserId(),mySite.getGroupId(), roleIds);

Any help appriciated


Participate in the State of Liferay Community 2017. Help the community and even win some prizes!