Example usage for com.liferay.portal.kernel.model User getGroups

List of usage examples for com.liferay.portal.kernel.model User getGroups

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model User getGroups.

Prototype

public java.util.List<Group> getGroups();

Source Link

Usage

From source file:com.liferay.osb.scv.connector.internal.model.SCVGroup.java

License:Open Source License

@Override
public List<Group> getModels(User user) throws Exception {
    return user.getGroups();
}

From source file:eu.gerhards.liferay.services.angular.service.impl.AngularUserServiceImpl.java

License:Open Source License

@Override
public List<Group> getUserGroups(long userId) throws PortalException {

    _log.info("Getting groups for user with id: " + String.valueOf(userId));

    _log.debug("    ... security check ...");

    PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.VIEW);

    _log.debug("    ... getting information");

    User user = UserLocalServiceUtil.getUser(userId);
    List<Group> groups = new ArrayList<>();

    if (user != null) {
        groups = user.getGroups();
    }/*  w  ww . j a v a  2 s  .  co  m*/

    return groups;
}