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

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

Introduction

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

Prototype

String VIEW

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

Click Source Link

Usage

From source file:com.liferay.document.library.internal.trash.DLFileEntryTrashHandler.java

License:Open Source License

@Override
protected boolean hasPermission(PermissionChecker permissionChecker, long classPK, String actionId)
        throws PortalException {

    DLFileEntry dlFileEntry = getDLFileEntry(classPK);

    if (dlFileEntry.isInHiddenFolder() && actionId.equals(ActionKeys.VIEW)) {

        return false;
    }//from  w  w  w  . ja  v a2s . c om

    return DLFileEntryPermission.contains(permissionChecker, classPK, actionId);
}

From source file:com.liferay.document.library.internal.trash.DLFileShortcutTrashHandler.java

License:Open Source License

@Override
protected boolean hasPermission(PermissionChecker permissionChecker, long classPK, String actionId)
        throws PortalException {

    DLFileShortcut dlFileShortcut = getDLFileShortcut(classPK);

    if (dlFileShortcut.isInHiddenFolder() && actionId.equals(ActionKeys.VIEW)) {

        return false;
    }//from www  .  j a v  a2s. co m

    return DLFileShortcutPermission.contains(permissionChecker, classPK, actionId);
}

From source file:com.liferay.document.library.internal.trash.DLFolderTrashHandler.java

License:Open Source License

@Override
protected boolean hasPermission(PermissionChecker permissionChecker, long classPK, String actionId)
        throws PortalException {

    DLFolder dlFolder = getDLFolder(classPK);

    if (dlFolder.isInHiddenFolder() && actionId.equals(ActionKeys.VIEW)) {
        return false;
    }/*from w  ww.j  ava 2 s  .c  om*/

    return DLFolderPermission.contains(permissionChecker, dlFolder, actionId);
}

From source file:com.liferay.document.library.permission.test.DLFileEntryPermissionCheckerTest.java

License:Open Source License

@Test
public void testContains() throws Exception {
    Assert.assertTrue(DLFileEntryPermission.contains(permissionChecker, _fileEntry, ActionKeys.VIEW));
    Assert.assertTrue(DLFileEntryPermission.contains(permissionChecker, _subfileEntry, ActionKeys.VIEW));

    removePortletModelViewPermission();//from  w  w w .j a v  a 2 s  .  co m

    Assert.assertFalse(DLFileEntryPermission.contains(permissionChecker, _fileEntry, ActionKeys.VIEW));
    Assert.assertFalse(DLFileEntryPermission.contains(permissionChecker, _subfileEntry, ActionKeys.VIEW));
}

From source file:com.liferay.document.library.permission.test.DLFileEntryPermissionCheckerTest.java

License:Open Source License

@Override
protected void removePortletModelViewPermission() throws Exception {
    super.removePortletModelViewPermission();

    RoleTestUtil.removeResourcePermission(RoleConstants.GUEST, getResourceName(),
            ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(group.getGroupId()), ActionKeys.VIEW);
}

From source file:com.liferay.document.library.permission.test.DLFolderPermissionCheckerTest.java

License:Open Source License

@Test
public void testContains() throws Exception {
    Assert.assertTrue(DLFolderPermission.contains(permissionChecker, _folder, ActionKeys.VIEW));
    Assert.assertTrue(DLFolderPermission.contains(permissionChecker, _subfolder, ActionKeys.VIEW));

    removePortletModelViewPermission();// w  w  w. j  ava2  s  .c om

    Assert.assertFalse(DLFolderPermission.contains(permissionChecker, _folder, ActionKeys.VIEW));
    Assert.assertFalse(DLFolderPermission.contains(permissionChecker, _subfolder, ActionKeys.VIEW));
}

From source file:com.liferay.document.library.service.test.DLCheckInCheckOutTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    _group = GroupTestUtil.addGroup();//  w w w  .j  av a2s.c  om

    RoleTestUtil.addResourcePermission(RoleConstants.POWER_USER, DLFolderConstants.getClassName(),
            ResourceConstants.SCOPE_GROUP_TEMPLATE, String.valueOf(GroupConstants.DEFAULT_PARENT_GROUP_ID),
            ActionKeys.ADD_DOCUMENT);

    RoleTestUtil.addResourcePermission(RoleConstants.GUEST, DLPermission.RESOURCE_NAME,
            ResourceConstants.SCOPE_GROUP, String.valueOf(_group.getGroupId()), ActionKeys.VIEW);

    _authorUser = UserTestUtil.addUser("author", _group.getGroupId());
    _overriderUser = UserTestUtil.addUser("overrider", _group.getGroupId());

    _serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId(), 0);

    _folder = createFolder("CheckInCheckOutTest");

    _fileEntry = createFileEntry(_FILE_NAME);
}

From source file:com.liferay.document.library.service.test.DLCheckInCheckOutTest.java

License:Open Source License

@After
public void tearDown() throws Exception {
    RoleTestUtil.removeResourcePermission(RoleConstants.GUEST, DLPermission.RESOURCE_NAME,
            ResourceConstants.SCOPE_GROUP, String.valueOf(_group.getGroupId()), ActionKeys.VIEW);
}

From source file:com.liferay.document.library.service.test.DLFileVersionTest.java

License:Open Source License

protected void setUpResourcePermission() throws Exception {
    RoleTestUtil.addResourcePermission(RoleConstants.GUEST, "com.liferay.document.library",
            ResourceConstants.SCOPE_GROUP, String.valueOf(_group.getGroupId()), ActionKeys.VIEW);
}

From source file:com.liferay.document.library.service.test.DLFileVersionTest.java

License:Open Source License

protected void tearDownResourcePermission() throws Exception {
    RoleTestUtil.removeResourcePermission(RoleConstants.GUEST, "com.liferay.document.library",
            ResourceConstants.SCOPE_GROUP, String.valueOf(_group.getGroupId()), ActionKeys.VIEW);
}