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 ?

Jimmy Bway
  • 37
  • 7

1 Answers1

2

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()});
Sandeep Nair
  • 3,630
  • 3
  • 26
  • 38
  • Thanks I was about to update this post because I've tried this solution earlier and it worked. And now I just saw that u answered me. Thanks – Jimmy Bway Aug 07 '13 at 02:59