Example usage for com.liferay.portal.kernel.comment DiscussionPermission hasUpdatePermission

List of usage examples for com.liferay.portal.kernel.comment DiscussionPermission hasUpdatePermission

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.comment DiscussionPermission hasUpdatePermission.

Prototype

public boolean hasUpdatePermission(long commentId) throws PortalException;

Source Link

Usage

From source file:com.liferay.comment.web.internal.asset.CommentAssetRenderer.java

License:Open Source License

@Override
public boolean hasEditPermission(PermissionChecker permissionChecker) throws PortalException {

    DiscussionPermission discussionPermission = CommentManagerUtil.getDiscussionPermission(permissionChecker);

    return discussionPermission.hasUpdatePermission(_workflowableComment.getCommentId());
}

From source file:com.liferay.screens.service.impl.ScreensCommentServiceImpl.java

License:Open Source License

protected JSONObject toJSONObject(Comment comment, DiscussionPermission discussionPermission)
        throws PortalException {

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

    jsonObject.put("body", comment.getBody());
    jsonObject.put("commentId", Long.valueOf(comment.getCommentId()));

    Date createDate = comment.getCreateDate();

    jsonObject.put("createDate", Long.valueOf(createDate.getTime()));

    jsonObject.put("deletePermission", discussionPermission.hasDeletePermission(comment.getCommentId()));

    Date modifiedDate = comment.getModifiedDate();

    jsonObject.put("modifiedDate", Long.valueOf(modifiedDate.getTime()));

    jsonObject.put("updatePermission", discussionPermission.hasUpdatePermission(comment.getCommentId()));
    jsonObject.put("userId", Long.valueOf(comment.getUserId()));
    jsonObject.put("userName", comment.getUserName());

    return jsonObject;
}