Search code examples
javaapiliferayliferay-6liferay-ide

Assign UserGroup to Role - Liferay 6.1.1


I'm currently working with Liferay 6.1.1, and i'm coding a hook for default values.

Im desperatly looking for a way to assign userGroup to a Role via the API.

Can someone help ?


Solution

  • I have not tried it but can you do something like this

    //Get group from UserGroup
    Group group = userGroup.getGroup();
    //Assign it to the role
    GroupLocalServiceUtil.addRoleGroups(roleId, new long[]{group.getGroupId()});