use of org.orcid.jaxb.model.v3.dev1.record.WorkBulk in project ORCID-Source by ORCID.
the class OrcidSecurityManager_WorkBulkTest method testMixedPublicAndLimitedWorkBulkReadPublicTokenMatchingSource.
@Test
public void testMixedPublicAndLimitedWorkBulkReadPublicTokenMatchingSource() {
WorkBulk workBulk = new WorkBulk();
workBulk.setBulk(Arrays.asList(createWork(Visibility.PUBLIC, CLIENT_2), createWork(Visibility.LIMITED, CLIENT_2)));
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_2, ScopePathType.READ_PUBLIC);
orcidSecurityManager.checkAndFilter(ORCID_1, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
assertNotNull(workBulk);
assertEquals(2, workBulk.getBulk().size());
}
use of org.orcid.jaxb.model.v3.dev1.record.WorkBulk in project ORCID-Source by ORCID.
the class OrcidSecurityManager_WorkBulkTest method testWorkBulkWrongToken.
@Test(expected = OrcidUnauthorizedException.class)
public void testWorkBulkWrongToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_WORKS_READ_LIMITED);
WorkBulk workBulk = new WorkBulk();
orcidSecurityManager.checkAndFilter(ORCID_2, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
fail();
}
use of org.orcid.jaxb.model.v3.dev1.record.WorkBulk in project ORCID-Source by ORCID.
the class OrcidSecurityManager_WorkBulkTest method testPrivateWorkBulkReadLimitedTokenMixedSources.
@Test
public void testPrivateWorkBulkReadLimitedTokenMixedSources() {
WorkBulk workBulk = new WorkBulk();
workBulk.setBulk(Arrays.asList(createWork(Visibility.PRIVATE, CLIENT_1), createWork(Visibility.PRIVATE, CLIENT_2)));
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_2, ScopePathType.READ_LIMITED);
orcidSecurityManager.checkAndFilter(ORCID_1, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
assertNotNull(workBulk);
assertEquals(2, workBulk.getBulk().size());
assertTrue(workBulk.getBulk().get(0) instanceof OrcidError);
assertTrue(workBulk.getBulk().get(1) instanceof Work);
}
use of org.orcid.jaxb.model.v3.dev1.record.WorkBulk in project ORCID-Source by ORCID.
the class OrcidSecurityManager_WorkBulkTest method testPrivateWorkBulkReadLimitedTokenMatchingSource.
@Test
public void testPrivateWorkBulkReadLimitedTokenMatchingSource() {
WorkBulk workBulk = new WorkBulk();
workBulk.setBulk(Arrays.asList(createWork(Visibility.PRIVATE, CLIENT_2)));
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_2, ScopePathType.READ_LIMITED);
orcidSecurityManager.checkAndFilter(ORCID_1, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
assertNotNull(workBulk);
assertEquals(1, workBulk.getBulk().size());
}
use of org.orcid.jaxb.model.v3.dev1.record.WorkBulk in project ORCID-Source by ORCID.
the class OrcidSecurityManager_WorkBulkTest method testMixedPublicAndLimitedWorkBulkReadLimitedToken.
@Test
public void testMixedPublicAndLimitedWorkBulkReadLimitedToken() {
WorkBulk workBulk = new WorkBulk();
workBulk.setBulk(Arrays.asList(createWork(Visibility.PUBLIC, CLIENT_2), createWork(Visibility.LIMITED, CLIENT_2)));
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_LIMITED);
orcidSecurityManager.checkAndFilter(ORCID_1, workBulk, ScopePathType.ORCID_WORKS_READ_LIMITED);
assertNotNull(workBulk);
assertEquals(2, workBulk.getBulk().size());
assertTrue(workBulk.getBulk().get(0) instanceof Work);
assertTrue(workBulk.getBulk().get(1) instanceof Work);
}
Aggregations