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

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

Introduction

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

Prototype

String UNLINK_LAYOUT_SET_PROTOTYPE

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

Click Source Link

Usage

From source file:com.liferay.users.admin.web.internal.portlet.action.EditProfileAndPrivateAreaMVCActionCommand.java

License:Open Source License

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

    User user = _portal.getSelectedUser(actionRequest);

    Group group = user.getGroup();

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

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (GroupPermissionUtil.contains(permissionChecker, group.getGroupId(), ActionKeys.UPDATE)
            && PortalPermissionUtil.contains(permissionChecker, ActionKeys.UNLINK_LAYOUT_SET_PROTOTYPE)) {

        long publicLayoutSetPrototypeId = ParamUtil.getLong(actionRequest, "publicLayoutSetPrototypeId");
        long privateLayoutSetPrototypeId = ParamUtil.getLong(actionRequest, "privateLayoutSetPrototypeId");
        boolean publicLayoutSetPrototypeLinkEnabled = ParamUtil.getBoolean(actionRequest,
                "publicLayoutSetPrototypeLinkEnabled");
        boolean privateLayoutSetPrototypeLinkEnabled = ParamUtil.getBoolean(actionRequest,
                "privateLayoutSetPrototypeLinkEnabled");

        LayoutSet publicLayoutSet = group.getPublicLayoutSet();
        LayoutSet privateLayoutSet = group.getPrivateLayoutSet();

        if ((publicLayoutSetPrototypeId > 0) || (privateLayoutSetPrototypeId > 0)
                || (publicLayoutSetPrototypeLinkEnabled != publicLayoutSet.isLayoutSetPrototypeLinkEnabled())
                || (privateLayoutSetPrototypeLinkEnabled != privateLayoutSet
                        .isLayoutSetPrototypeLinkEnabled())) {

            _sites.updateLayoutSetPrototypesLinks(group, publicLayoutSetPrototypeId,
                    privateLayoutSetPrototypeId, publicLayoutSetPrototypeLinkEnabled,
                    privateLayoutSetPrototypeLinkEnabled);
        }//  ww w .j a v  a2s . c o  m
    }
}