Question

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

Était-ce utile?

La solution

try in this way

UserGroup ug = UserGroupLocalServiceUtil.getUserGroup(PortalUtil.getCompanyId(request), "your_user_group_name");

long [] ugIds = {ug.getGroup().getGroupId()};

GroupLocalServiceUtil.addRoleGroups(yourRoleId, ugIds );
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top