Example usage for com.liferay.portal.kernel.security.permission ActionKeys VIEW

List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys VIEW

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.security.permission ActionKeys VIEW.

Prototype

String VIEW

To view the source code for com.liferay.portal.kernel.security.permission ActionKeys VIEW.

Click Source Link

Usage

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

License:Open Source License

@Override
public boolean hasTeamUserGroups(long teamId) throws PortalException {

    _log.info("Checking if team " + teamId + " has user groups");

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

    this.checkMultiplePersonalPermission(
            new String[] { AngularActionKeys.LIST_TEAMS, AngularActionKeys.LIST_USER_USER_GROUPS });

    TeamPermissionUtil.check(getPermissionChecker(), teamId, ActionKeys.VIEW);

    _log.debug("    ... processing ... ");

    return UserGroupLocalServiceUtil.hasTeamUserGroups(teamId);
}

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

License:Open Source License

@Override
public boolean isUserMemberOfUserGroup(long userId, long userGroupId) throws PortalException {

    _log.info("Checking if team with id " + userId + " has user group with id " + userGroupId);

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

    this.checkMultiplePersonalPermission(
            new String[] { AngularActionKeys.LIST_USERS, AngularActionKeys.LIST_USER_USER_GROUPS });

    UserPermissionUtil.check(getPermissionChecker(), userId, ActionKeys.VIEW);

    this.hasResourcePermission(userGroupId, ActionKeys.VIEW);

    _log.debug("    ... processing ... ");

    return UserGroupLocalServiceUtil.hasUserUserGroup(userId, userGroupId);
}

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

License:Open Source License

@Override
public boolean hasUserUserGroups(long userId) throws PortalException {

    _log.info("Checking if team " + userId + " has user groups");

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

    this.checkMultiplePersonalPermission(
            new String[] { AngularActionKeys.LIST_USERS, AngularActionKeys.LIST_USER_USER_GROUPS });

    TeamPermissionUtil.check(getPermissionChecker(), userId, ActionKeys.VIEW);

    _log.debug("    ... processing ... ");

    return UserGroupLocalServiceUtil.hasUserUserGroups(userId);
}

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

License:Open Source License

@Override
public boolean hasPermission(long userGroupId, String actionId) throws PortalException {

    _log.info("Checking permission for user group with id " + userGroupId);

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

    PortalPermissionUtil.check(getPermissionChecker(), AngularActionKeys.CHECK_PERMISSIONS);

    this.checkPersonalPermission(AngularActionKeys.LIST_USER_USER_GROUPS);

    this.hasResourcePermission(userGroupId, ActionKeys.VIEW);

    _log.debug("    ... processing ...");

    try {/* w w  w. j a  v a 2s  .  co  m*/
        this.hasResourcePermission(userGroupId, actionId);
        return true;
    } catch (PortalException pe) {
        return false;
    }
}

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

License:Open Source License

@Override
public User getUser(long userId) throws PortalException {

    _log.info("getting user with id: " + String.valueOf(userId));

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

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

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

    User user = UserLocalServiceUtil.getUser(userId);
    Contact userContact = ContactLocalServiceUtil.getContact(user.getContactId());

    List<Role> userRoles = RoleLocalServiceUtil.getUserRoles(user.getUserId());
    List<Group> userGroups = GroupLocalServiceUtil.getUserGroups(user.getUserId());
    List<Organization> userOrganizations = OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId());
    List<UserGroup> userUserGroups = UserGroupLocalServiceUtil.getUserUserGroups(user.getUserId());

    return user;//from w w w .ja  v a 2s.  c  om
}

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

License:Open Source License

@Override
public List<Address> getUserAddress(long userId) throws PortalException {

    _log.info("getting addresses 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<Address> addresses = new ArrayList<>();
    if (user != null) {
        addresses = user.getAddresses();
    }//  w w  w  .j ava 2 s .c om

    return addresses;
}

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

License:Open Source License

@Override
public List<EmailAddress> getUserEmailAddresses(long userId) throws PortalException {

    _log.info("getting email addresses 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<EmailAddress> emailAddresses = new ArrayList<>();

    if (user != null) {
        emailAddresses = user.getEmailAddresses();
    }/*from  w w w. j  a v  a 2  s  .com*/

    return emailAddresses;
}

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

License:Open Source License

@Override
public List<Phone> getUserPhones(long userId) throws PortalException {

    _log.info("getting phones 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<Phone> phones = new ArrayList<>();

    if (user != null) {
        phones = user.getPhones();// w w  w.  j  av a  2 s .c o  m
    }
    return phones;
}

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

License:Open Source License

@Override
public List<Website> getUserWebsites(long userId) throws PortalException {

    _log.info("Getting websites 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<Website> websites = new ArrayList<>();

    if (user != null) {
        websites = user.getWebsites();// w ww. j a  v a2 s  . c om
    }

    return websites;
}

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

License:Open Source License

@Override
public Contact getUserContact(long userId) throws PortalException {

    _log.info("Getting contact record 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);
    Contact contact = null;//from www .j a v  a  2  s . c  o m

    if (user != null) {
        contact = user.fetchContact();
    }

    return contact;
}