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

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

Introduction

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

Prototype

String ASSIGN_USER_ROLES

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

Click Source Link

Usage

From source file:com.liferay.users.admin.web.internal.portlet.configuration.icon.AssignOrganizationRolesPortletConfigurationIcon.java

License:Open Source License

@Override
public boolean isShow(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    try {// www .  j  ava2 s  .c  o  m
        PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

        Organization organization = ActionUtil.getOrganization(portletRequest);

        long organizationGroupId = organization.getGroupId();

        if (permissionChecker.isGroupOwner(organizationGroupId) || OrganizationPermissionUtil
                .contains(permissionChecker, organization, ActionKeys.ASSIGN_USER_ROLES)) {

            return true;
        }
    } catch (Exception e) {
    }

    return false;
}