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

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

Introduction

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

Prototype

String VIEW_STAGING

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

Click Source Link

Usage

From source file:com.liferay.exportimport.staging.StagingImpl.java

License:Open Source License

@Override
public Group getPermissionStagingGroup(Group group) {
    if (group == null) {
        return null;
    }/*from   w w  w .j  a v a2 s  .  c om*/

    Group stagingGroup = group;

    if (!group.isStagedRemotely() && group.hasStagingGroup()) {
        try {
            PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();

            long scopeGroupId = stagingGroup.getGroupId();

            boolean hasManageStagingPermission = GroupPermissionUtil.contains(permissionChecker, scopeGroupId,
                    ActionKeys.MANAGE_STAGING);
            boolean hasPublishStagingPermission = GroupPermissionUtil.contains(permissionChecker, scopeGroupId,
                    ActionKeys.PUBLISH_STAGING);
            boolean hasViewStagingPermission = GroupPermissionUtil.contains(permissionChecker, scopeGroupId,
                    ActionKeys.VIEW_STAGING);

            if (hasManageStagingPermission || hasPublishStagingPermission || hasViewStagingPermission) {

                stagingGroup = group.getStagingGroup();
            }
        } catch (Exception e) {
        }
    }

    return stagingGroup;
}

From source file:com.liferay.product.navigation.site.administration.internal.display.context.SiteAdministrationPanelCategoryDisplayContext.java

License:Open Source License

protected boolean hasStagingPermission() throws PortalException {
    if (!GroupPermissionUtil.contains(_themeDisplay.getPermissionChecker(), getGroup(),
            ActionKeys.MANAGE_STAGING)) {

        return false;
    }/*ww w.  ja  v a2 s .c  om*/

    if (!GroupPermissionUtil.contains(_themeDisplay.getPermissionChecker(), getGroup(),
            ActionKeys.PUBLISH_STAGING)) {

        return false;
    }

    if (!GroupPermissionUtil.contains(_themeDisplay.getPermissionChecker(), getGroup(),
            ActionKeys.VIEW_STAGING)) {

        return false;
    }

    return true;
}

From source file:com.liferay.site.util.GroupURLProvider.java

License:Open Source License

protected String getGroupURL(Group group, PortletRequest portletRequest, boolean includeStagingGroup) {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    String groupDisplayURL = group.getDisplayURL(themeDisplay, false);

    if (Validator.isNotNull(groupDisplayURL)) {
        return _http.removeParameter(groupDisplayURL, "p_p_id");
    }//w w  w . j a v  a  2s  . co m

    groupDisplayURL = group.getDisplayURL(themeDisplay, true);

    if (Validator.isNotNull(groupDisplayURL)) {
        return _http.removeParameter(groupDisplayURL, "p_p_id");
    }

    if (includeStagingGroup && group.hasStagingGroup()) {
        try {
            if (GroupPermissionUtil.contains(themeDisplay.getPermissionChecker(), group,
                    ActionKeys.VIEW_STAGING)) {

                return getGroupURL(group.getStagingGroup(), portletRequest);
            }
        } catch (PortalException pe) {
            _log.error("Unable to check permission on group " + group.getGroupId(), pe);
        }
    }

    return getGroupAdministrationURL(group, portletRequest);
}

From source file:com.liferay.staging.processes.web.internal.portlet.StagingProcessesControlPanelEntry.java

License:Open Source License

@Override
protected boolean hasAccessPermissionDenied(PermissionChecker permissionChecker, Group group, Portlet portlet)
        throws Exception {

    if (!PropsValues.STAGING_LIVE_GROUP_REMOTE_STAGING_ENABLED && group.hasLocalOrRemoteStagingGroup()) {

        return true;
    }/* w  w  w . j  a v a 2 s.  c  o  m*/

    if (group.isLayoutPrototype() || group.isLayoutSetPrototype()) {
        return true;
    }

    if (!GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.VIEW_STAGING)) {

        return true;
    }

    return super.hasAccessPermissionDenied(permissionChecker, group, portlet);
}

From source file:com.liferay.staging.processes.web.internal.portlet.StagingProcessesControlPanelEntry.java

License:Open Source License

@Override
protected boolean hasAccessPermissionExplicitlyGranted(PermissionChecker permissionChecker, Group group,
        Portlet portlet) throws PortalException {

    if (GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.VIEW_STAGING)) {

        return true;
    }/*w ww .j  a  v  a  2 s .c  o m*/

    return super.hasAccessPermissionExplicitlyGranted(permissionChecker, group, portlet);
}