Skip to content

Instantly share code, notes, and snippets.

@beeTechMantra
Created September 13, 2020 05:23
Show Gist options
  • Save beeTechMantra/dbe4e90b15e62841c49877a7bae5f4fb to your computer and use it in GitHub Desktop.
Save beeTechMantra/dbe4e90b15e62841c49877a7bae5f4fb to your computer and use it in GitHub Desktop.
Get User's regular roles by userId Groovy script Liferay
import java.util.List
import com.liferay.portal.kernel.model.Role
import com.liferay.portal.kernel.service.RoleLocalServiceUtil
try{
List<Role> roles = RoleLocalServiceUtil.getUserRoles(5890933);
for(Role role : roles) {
out.println("roleId : " + role.getRoleId());
out.println("roleName : " + role.getName());
out.println("==========================================");
}
}catch(e) {
out.println(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment