Reputation: 2064
I'm looking for a way to add an usergroup to a role. I couldn't find a solution in the API or liferay forum. Is something like that possible for usergroups?
GroupLocalServiceUtil.addRoleGroups(portalrole.getRoleId(), grouplist);
It only works for groups. RoleLocalServiceUtil, UserGroupLocalServiceUtil and so on don't have some methods like this.
environment: Liferay. 5.2.3
Upvotes: 1
Views: 1250
Reputation: 196
try in this way
UserGroup ug = UserGroupLocalServiceUtil.getUserGroup(PortalUtil.getCompanyId(request), "your_user_group_name");
long [] ugIds = {ug.getGroup().getGroupId()};
GroupLocalServiceUtil.addRoleGroups(yourRoleId, ugIds );
Upvotes: 2