use of org.orcid.core.exception.OrcidAccessControlException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_DistinctionsTest method testReadPublicScope_Distinctions.
@Test
public void testReadPublicScope_Distinctions() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewDistinction(ORCID, 27L);
assertNotNull(r);
assertEquals(Distinction.class.getName(), r.getEntity().getClass().getName());
r = serviceDelegator.viewDistinctionSummary(ORCID, 27L);
assertNotNull(r);
assertEquals(DistinctionSummary.class.getName(), r.getEntity().getClass().getName());
// Limited that am the source of should work
serviceDelegator.viewDistinction(ORCID, 28L);
serviceDelegator.viewDistinctionSummary(ORCID, 28L);
// Limited that am not the source of should fail
try {
serviceDelegator.viewDistinction(ORCID, 30L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewDistinctionSummary(ORCID, 30L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
// Private that am the source of should work
serviceDelegator.viewDistinction(ORCID, 29L);
serviceDelegator.viewDistinctionSummary(ORCID, 29L);
// Private that am not the source of should fails
try {
serviceDelegator.viewDistinction(ORCID, 31L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewDistinctionSummary(ORCID, 31L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
}
use of org.orcid.core.exception.OrcidAccessControlException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_EmploymentsTest method testReadPublicScope_Employments.
@Test
public void testReadPublicScope_Employments() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewEmployment(ORCID, 17L);
assertNotNull(r);
assertEquals(Employment.class.getName(), r.getEntity().getClass().getName());
r = serviceDelegator.viewEmploymentSummary(ORCID, 17L);
assertNotNull(r);
assertEquals(EmploymentSummary.class.getName(), r.getEntity().getClass().getName());
// Limited that am the source of should work
serviceDelegator.viewEmployment(ORCID, 18L);
serviceDelegator.viewEmploymentSummary(ORCID, 18L);
// Limited that am not the source of should fail
try {
serviceDelegator.viewEmployment(ORCID, 23L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewEmploymentSummary(ORCID, 23L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
// Private that am the source of should work
serviceDelegator.viewEmployment(ORCID, 19L);
serviceDelegator.viewEmploymentSummary(ORCID, 19L);
// Private that am not the source of should fail
try {
serviceDelegator.viewEmployment(ORCID, 24L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewEmploymentSummary(ORCID, 24L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
}
use of org.orcid.core.exception.OrcidAccessControlException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_FundingTest method testReadPublicScope_Funding.
@Test
public void testReadPublicScope_Funding() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
// Public works
Response r = serviceDelegator.viewFunding(ORCID, 10L);
assertNotNull(r);
assertEquals(Funding.class.getName(), r.getEntity().getClass().getName());
r = serviceDelegator.viewFundingSummary(ORCID, 10L);
assertNotNull(r);
assertEquals(FundingSummary.class.getName(), r.getEntity().getClass().getName());
// Limited that am the source of should work
serviceDelegator.viewFunding(ORCID, 11L);
serviceDelegator.viewFundingSummary(ORCID, 11L);
// Limited that am not the source of should fail
try {
serviceDelegator.viewFunding(ORCID, 13L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewFundingSummary(ORCID, 13L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
// Private that am the source of should work
serviceDelegator.viewFunding(ORCID, 12L);
serviceDelegator.viewFundingSummary(ORCID, 12L);
// Private am not the source of should fail
try {
serviceDelegator.viewFunding(ORCID, 14L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewFundingSummary(ORCID, 14L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
}
use of org.orcid.core.exception.OrcidAccessControlException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_InvitedPositionsTest method testReadPublicScope_InvitedPositions.
@Test
public void testReadPublicScope_InvitedPositions() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewInvitedPosition(ORCID, 32L);
assertNotNull(r);
assertEquals(InvitedPosition.class.getName(), r.getEntity().getClass().getName());
r = serviceDelegator.viewInvitedPositionSummary(ORCID, 32L);
assertNotNull(r);
assertEquals(InvitedPositionSummary.class.getName(), r.getEntity().getClass().getName());
// Limited that am the source of should work
serviceDelegator.viewInvitedPosition(ORCID, 33L);
serviceDelegator.viewInvitedPositionSummary(ORCID, 33L);
// Private that am the source of should work
serviceDelegator.viewInvitedPosition(ORCID, 34L);
serviceDelegator.viewInvitedPositionSummary(ORCID, 34L);
// Limited that am not the source of should fail
try {
serviceDelegator.viewInvitedPosition(ORCID, 35L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewInvitedPositionSummary(ORCID, 35L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
// Private that am not the source of should fails
try {
serviceDelegator.viewInvitedPosition(ORCID, 35L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewInvitedPositionSummary(ORCID, 35L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
}
use of org.orcid.core.exception.OrcidAccessControlException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_PeerReviewsTest method testReadPublicScope_PeerReview.
@Test
public void testReadPublicScope_PeerReview() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_PUBLIC);
// Public works
Response r = serviceDelegator.viewPeerReview(ORCID, 9L);
assertNotNull(r);
assertEquals(PeerReview.class.getName(), r.getEntity().getClass().getName());
r = serviceDelegator.viewPeerReviewSummary(ORCID, 9L);
assertNotNull(r);
assertEquals(PeerReviewSummary.class.getName(), r.getEntity().getClass().getName());
// Limited where am the source of should work
serviceDelegator.viewPeerReview(ORCID, 10L);
serviceDelegator.viewPeerReviewSummary(ORCID, 10L);
// Limited where am not the source of should fail
try {
serviceDelegator.viewPeerReview(ORCID, 12L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewPeerReviewSummary(ORCID, 12L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
// Limited where am the source of should work
serviceDelegator.viewPeerReview(ORCID, 11L);
serviceDelegator.viewPeerReviewSummary(ORCID, 11L);
// Limited where am not the source of should fail
try {
serviceDelegator.viewPeerReview(ORCID, 13L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
try {
serviceDelegator.viewPeerReviewSummary(ORCID, 13L);
fail();
} catch (OrcidAccessControlException e) {
} catch (Exception e) {
fail();
}
}
Aggregations