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

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

Introduction

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

Prototype

String CUSTOMIZE

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

Click Source Link

Usage

From source file:com.liferay.exportimport.internal.staging.permission.StagingPermissionImpl.java

License:Open Source License

protected Boolean doHasPermission(PermissionChecker permissionChecker, Group group, String className,
        long classPK, String portletId, String actionId) throws Exception {

    if (!PropsValues.STAGING_LIVE_GROUP_LOCKING_ENABLED) {
        return null;
    }//from   ww w.j a  v a 2 s .c  o m

    if (!actionId.equals(ActionKeys.ACCESS) && !actionId.equals(ActionKeys.ACCESS_IN_CONTROL_PANEL)
            && !actionId.equals(ActionKeys.ADD_TO_PAGE) && !actionId.equals(ActionKeys.ASSIGN_MEMBERS)
            && !actionId.equals(ActionKeys.CONFIGURATION) && !actionId.equals(ActionKeys.CUSTOMIZE)
            && !actionId.equals(ActionKeys.DELETE) && !actionId.equals(ActionKeys.VIEW)
            && group.hasLocalOrRemoteStagingGroup()
            && (Validator.isNull(portletId) || group.isStagedPortlet(portletId))) {

        return false;
    } else {
        return null;
    }
}

From source file:com.liferay.exportimport.test.LayoutSetPrototypePropagationTest.java

License:Open Source License

@Ignore
@Test//from ww w  .  j av  a  2  s.c o  m
public void testLayoutPermissionPropagationWithLinkEnabled() throws Exception {

    setLinkEnabled(true);

    Role role = RoleLocalServiceUtil.getRole(TestPropsValues.getCompanyId(), RoleConstants.POWER_USER);

    ResourcePermissionServiceUtil.setIndividualResourcePermissions(prototypeLayout.getGroupId(),
            prototypeLayout.getCompanyId(), Layout.class.getName(),
            String.valueOf(prototypeLayout.getPrimaryKey()), role.getRoleId(),
            new String[] { ActionKeys.CUSTOMIZE });

    prototypeLayout = updateModifiedDate(prototypeLayout, new Date(System.currentTimeMillis() + Time.MINUTE));

    CacheUtil.clearCache(prototypeLayout.getCompanyId());

    propagateChanges(group);

    Assert.assertTrue(ResourcePermissionLocalServiceUtil.hasResourcePermission(layout.getCompanyId(),
            Layout.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(layout.getPrimaryKey()),
            role.getRoleId(), ActionKeys.CUSTOMIZE));
}

From source file:com.liferay.layout.admin.web.internal.control.menu.CustomizationSettingsProductNavigationControlMenuEntry.java

License:Open Source License

protected boolean isCustomizableLayout(ThemeDisplay themeDisplay) throws PortalException {

    Layout layout = themeDisplay.getLayout();

    Group group = layout.getGroup();

    if (group.isLayoutPrototype() || group.isLayoutSetPrototype() || group.isStagingGroup()
            || group.isUserGroup()) {/*from  w  w w  .  j a v  a2s  .  com*/

        return false;
    }

    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    if (!layout.isTypePortlet() || (layoutTypePortlet == null)) {
        return false;
    }

    if (layout.isCustomizable() && hasUpdateLayoutPermission(themeDisplay)) {

        return true;
    }

    if (!layoutTypePortlet.isCustomizable()) {
        return false;
    }

    if (!LayoutPermissionUtil.containsWithoutViewableGroup(themeDisplay.getPermissionChecker(), layout, false,
            ActionKeys.CUSTOMIZE)) {

        return false;
    }

    return true;
}

From source file:com.liferay.layout.admin.web.internal.control.menu.ToggleControlsProductNavigationControlMenuEntry.java

License:Open Source License

protected boolean hasCustomizePermission(ThemeDisplay themeDisplay) throws PortalException {

    Layout layout = themeDisplay.getLayout();
    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    if (!layout.isTypePortlet() || (layoutTypePortlet == null)) {
        return false;
    }/*w w  w. j av a2s .  co m*/

    if (!layoutTypePortlet.isCustomizable() || !layoutTypePortlet.isCustomizedView()) {

        return false;
    }

    if (LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), layout, ActionKeys.CUSTOMIZE)) {

        return true;
    }

    return false;
}

From source file:com.liferay.layout.admin.web.internal.portlet.action.ResetCustomizationViewMVCActionCommand.java

License:Open Source License

@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

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

    if (!LayoutPermissionUtil.contains(themeDisplay.getPermissionChecker(), themeDisplay.getLayout(),
            ActionKeys.CUSTOMIZE)) {

        throw new PrincipalException();
    }/*from   ww  w. j  a  va 2s . co  m*/

    LayoutTypePortlet layoutTypePortlet = themeDisplay.getLayoutTypePortlet();

    if ((layoutTypePortlet != null) && layoutTypePortlet.isCustomizable()
            && layoutTypePortlet.isCustomizedView()) {

        layoutTypePortlet.resetUserPreferences();
    }

    MultiSessionMessages.add(actionRequest, _portal.getPortletId(actionRequest) + "requestProcessed");

    Layout layout = themeDisplay.getLayout();

    actionResponse.sendRedirect(layout.getRegularURL(_portal.getHttpServletRequest(actionRequest)));
}