Pregunta

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

¿Fue útil?

Solución

try in this way

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

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

GroupLocalServiceUtil.addRoleGroups(yourRoleId, ugIds );
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top