Example usage for com.liferay.portal.util PropsValues DISCUSSION_COMMENTS_ALWAYS_EDITABLE_BY_OWNER

List of usage examples for com.liferay.portal.util PropsValues DISCUSSION_COMMENTS_ALWAYS_EDITABLE_BY_OWNER

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues DISCUSSION_COMMENTS_ALWAYS_EDITABLE_BY_OWNER.

Prototype

boolean DISCUSSION_COMMENTS_ALWAYS_EDITABLE_BY_OWNER

To view the source code for com.liferay.portal.util PropsValues DISCUSSION_COMMENTS_ALWAYS_EDITABLE_BY_OWNER.

Click Source Link

Usage

From source file:com.liferay.message.boards.service.permission.MBDiscussionPermission.java

License:Open Source License

public static boolean contains(PermissionChecker permissionChecker, MBMessage message, String actionId)
        throws PortalException {

    String className = message.getClassName();

    if (className.equals(WorkflowInstance.class.getName())) {
        return permissionChecker.hasPermission(message.getGroupId(), PortletKeys.WORKFLOW_DEFINITION,
                message.getGroupId(), ActionKeys.VIEW);
    }// w w  w  .java 2 s. com

    if (PropsValues.DISCUSSION_COMMENTS_ALWAYS_EDITABLE_BY_OWNER
            && (permissionChecker.getUserId() == message.getUserId())) {

        return true;
    }

    if (message.isPending()) {
        Boolean hasPermission = WorkflowPermissionUtil.hasPermission(permissionChecker, message.getGroupId(),
                message.getWorkflowClassName(), message.getMessageId(), actionId);

        if (hasPermission != null) {
            return hasPermission.booleanValue();
        }
    }

    return contains(permissionChecker, message.getCompanyId(), message.getGroupId(), className,
            message.getClassPK(), actionId);
}

From source file:com.liferay.portlet.messageboards.service.permission.MBDiscussionPermission.java

License:Open Source License

public static boolean contains(PermissionChecker permissionChecker, long companyId, long groupId,
        String className, long classPK, long messageId, long ownerId, String actionId)
        throws PortalException, SystemException {

    MBMessage message = MBMessageLocalServiceUtil.getMessage(messageId);

    if (PropsValues.DISCUSSION_COMMENTS_ALWAYS_EDITABLE_BY_OWNER
            && (permissionChecker.getUserId() == message.getUserId())) {

        return true;
    }//from  w w w  .j  a va  2 s .c  om

    if (message.isPending()) {
        Boolean hasPermission = WorkflowPermissionUtil.hasPermission(permissionChecker, message.getGroupId(),
                message.getWorkflowClassName(), message.getMessageId(), actionId);

        if (hasPermission != null) {
            return hasPermission.booleanValue();
        }
    }

    return contains(permissionChecker, companyId, groupId, className, classPK, ownerId, actionId);
}