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

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

Introduction

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

Prototype

String LOCK_THREAD

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

Click Source Link

Usage

From source file:com.liferay.message.boards.internal.upgrade.v1_0_1.UpgradeUnsupportedGuestPermissions.java

License:Open Source License

@Override
public void upgrade(DBProcessContext dbProcessContext) throws UpgradeException {

    _removeResourceActions(MBCategory.class.getName(), ActionKeys.DELETE);
    _removeResourceActions(MBCategory.class.getName(), ActionKeys.MOVE_THREAD);
    _removeResourceActions(MBCategory.class.getName(), ActionKeys.PERMISSIONS);

    _removeResourceActions(MBMessage.class.getName(), ActionKeys.DELETE);
    _removeResourceActions(MBMessage.class.getName(), ActionKeys.PERMISSIONS);

    _removeResourceActions(MBPermission.RESOURCE_NAME, ActionKeys.LOCK_THREAD);
    _removeResourceActions(MBPermission.RESOURCE_NAME, ActionKeys.MOVE_THREAD);

    _removeResourceActions(MBThread.class.getName(), ActionKeys.DELETE);
}

From source file:com.liferay.message.boards.web.internal.portlet.configuration.icon.ThreadLockPortletConfigurationIcon.java

License:Open Source License

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

    try {//  w  w w  . jav a 2 s  .c  o m
        MBMessage message = ActionUtil.getMessage(portletRequest);

        return MBCategoryPermission.contains(themeDisplay.getPermissionChecker(),
                themeDisplay.getScopeGroupId(), message.getCategoryId(), ActionKeys.LOCK_THREAD);
    } catch (Exception e) {
    }

    return false;
}

From source file:com.liferay.message.boards.web.internal.search.EntriesChecker.java

License:Open Source License

@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {

    MBThread thread = null;//from  ww  w. ja  v a 2s . co  m

    long entryId = GetterUtil.getLong(primaryKey);

    MBCategory category = MBCategoryLocalServiceUtil.fetchMBCategory(entryId);

    if (category == null) {
        thread = MBThreadLocalServiceUtil.fetchThread(entryId);
    }

    if ((category == null) && (thread == null)) {
        return StringPool.BLANK;
    }

    boolean showInput = false;

    String name = null;

    if (category != null) {
        name = MBCategory.class.getSimpleName();

        try {
            if (MBCategoryPermission.contains(_permissionChecker, category, ActionKeys.DELETE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    } else {
        name = MBThread.class.getSimpleName();

        try {
            if (MBCategoryPermission.contains(_permissionChecker, thread.getGroupId(), thread.getCategoryId(),
                    ActionKeys.LOCK_THREAD)
                    || MBMessagePermission.contains(_permissionChecker, thread.getRootMessageId(),
                            ActionKeys.DELETE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    }

    if (!showInput) {
        return StringPool.BLANK;
    }

    String checkBoxRowIds = getEntryRowIds();

    return getRowCheckBox(request, checked, disabled,
            _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name, primaryKey, checkBoxRowIds,
            "'#" + getAllRowIds() + "'", StringPool.BLANK);
}