Example usage for com.liferay.portal.kernel.security.permission PermissionChecker isGroupOwner

List of usage examples for com.liferay.portal.kernel.security.permission PermissionChecker isGroupOwner

Introduction

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

Prototype

public boolean isGroupOwner(long groupId);

Source Link

Document

Returns true if the user is the owner of the group.

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 {/*from w w w  . j a v a 2 s  .c om*/
        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;
}