Foros de discusión
Code to assign usergroup to role in liferay
A J, modificado hace 12 años.
Code to assign usergroup to role in liferay
Junior Member Mensajes: 91 Fecha de incorporación: 19/09/11 Mensajes recientes
How can I assign user group to roles, through code, in liferay ?
Thank you
Thank you
kehsihba eejrenab, modificado hace 12 años.
RE: Code to assign usergroup to role in liferay
Junior Member Mensajes: 82 Fecha de incorporación: 16/07/09 Mensajes recientes
check the rolelocalservice class
A J, modificado hace 12 años.
RE: Code to assign usergroup to role in liferay
Junior Member Mensajes: 91 Fecha de incorporación: 19/09/11 Mensajes recienteskehsihba eejrenab:
check the rolelocalservice class
Searched the class but I dint find a method that assigns a usergroup to a role. There is only getUserUserGroupRoles(). How can I assign existing user groups to a role ?
A J, modificado hace 12 años.
RE: Code to assign usergroup to role in liferay
Junior Member Mensajes: 91 Fecha de incorporación: 19/09/11 Mensajes recientes
I think its achieveable using UserGroupGroupRoleLocalServiceUtil.addUserGroupGroupRoles(long[] userGroupIds, long groupId, long roleId)
. But am not sure.
Moreover does anyone know what should I pass groupId as ?? I just want to assign a usergroup to role.
. But am not sure.
Moreover does anyone know what should I pass groupId as ?? I just want to assign a usergroup to role.
Tejas Kanani, modificado hace 12 años.
RE: Code to assign usergroup to role in liferay
Liferay Master Mensajes: 654 Fecha de incorporación: 6/01/09 Mensajes recientesA J:
Moreover does anyone know what should I pass groupId as ?? I just want to assign a usergroup to role.
You can use themeDisplay.getScopeGroupId() for groupId value.
Thanks,
Tejas Kanani
A J, modificado hace 12 años.
RE: Code to assign usergroup to role in liferay
Junior Member Mensajes: 91 Fecha de incorporación: 19/09/11 Mensajes recientes
Tried it, but its not assigning the user groups to the roles. Even tried UserGroupRoleServiceUtil.addUserGroupRoles(long userId, long groupId, long[] roleIds) where Group group=objUserGroup.getGroup(); groupid=group.getGroupId();
Even this is not assigning usergroup to roles.
Can anyone help regarding this issue ??
Thank you
Even this is not assigning usergroup to roles.
Can anyone help regarding this issue ??
Thank you
Tejas Kanani, modificado hace 12 años.
RE: Code to assign usergroup to role in liferay
Liferay Master Mensajes: 654 Fecha de incorporación: 6/01/09 Mensajes recientes
Try,
I hope it works.
Thanks,
Tejas Kanani
GroupLocalServiceUtil.addRoleGroups(long roleId, long[] groupIds)
I hope it works.
Thanks,
Tejas Kanani
A J, modificado hace 12 años.
RE: Code to assign usergroup to role in liferay
Junior Member Mensajes: 91 Fecha de incorporación: 19/09/11 Mensajes recientes
Thanks a lot Tejas !!!!
Is working !!!
GroupLocalServiceUtil.addRoleGroups(long roleId, long[] groupIds)
Is working !!!