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

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

Introduction

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

Prototype

String ADD_MESSAGE

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

Click Source Link

Usage

From source file:com.liferay.message.boards.internal.trash.MBThreadTrashHandler.java

License:Open Source License

@Override
public boolean hasTrashPermission(PermissionChecker permissionChecker, long groupId, long classPK,
        String trashActionId) throws PortalException {

    if (trashActionId.equals(TrashActionKeys.MOVE)) {
        return MBCategoryPermission.contains(permissionChecker, groupId, classPK, ActionKeys.ADD_MESSAGE);
    }//from  w  w  w.  j  a v a 2  s  .  c  o m

    return super.hasTrashPermission(permissionChecker, groupId, classPK, trashActionId);
}

From source file:com.liferay.message.boards.service.test.MBMessageServiceTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    String name = "Test Category";
    String description = "This is a test category.";
    String displayStyle = MBCategoryConstants.DEFAULT_DISPLAY_STYLE;
    String emailAddress = null;//w w w  . j a  v  a 2  s  .c o m
    String inProtocol = null;
    String inServerName = null;
    int inServerPort = 0;
    boolean inUseSSL = false;
    String inUserName = null;
    String inPassword = null;
    int inReadInterval = 0;
    String outEmailAddress = null;
    boolean outCustom = false;
    String outServerName = null;
    int outServerPort = 0;
    boolean outUseSSL = false;
    String outUserName = null;
    String outPassword = null;
    boolean allowAnonymous = false;
    boolean mailingListActive = false;

    _group = GroupTestUtil.addGroup();

    for (int i = 0; i < ServiceTestUtil.THREAD_COUNT; i++) {
        UserTestUtil.addUser(_group.getGroupId());
    }

    ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId());

    serviceContext.setGroupPermissions(new String[] { ActionKeys.ADD_MESSAGE, ActionKeys.VIEW });
    serviceContext.setGuestPermissions(new String[] { ActionKeys.ADD_MESSAGE, ActionKeys.VIEW });

    _category = MBCategoryServiceUtil.addCategory(MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID, name,
            description, displayStyle, emailAddress, inProtocol, inServerName, inServerPort, inUseSSL,
            inUserName, inPassword, inReadInterval, outEmailAddress, outCustom, outServerName, outServerPort,
            outUseSSL, outUserName, outPassword, allowAnonymous, mailingListActive, serviceContext);

    _userIds = UserLocalServiceUtil.getGroupUserIds(_group.getGroupId());
}