Search in sources :

Example 26 with Work

use of org.orcid.jaxb.model.record_rc2.Work in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testWork_CanRead_When_IsSource.

@Test
public void testWork_CanRead_When_IsSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
    Work work = createWork(Visibility.PUBLIC, CLIENT_1);
    orcidSecurityManager.checkAndFilter(ORCID_1, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
    work = createWork(Visibility.LIMITED, CLIENT_1);
    orcidSecurityManager.checkAndFilter(ORCID_1, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
    work = createWork(Visibility.PRIVATE, CLIENT_1);
    orcidSecurityManager.checkAndFilter(ORCID_1, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 27 with Work

use of org.orcid.jaxb.model.record_rc2.Work in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testWork_CanRead_When_ReadPublicToken_IsPublic_NotSource.

@Test
public void testWork_CanRead_When_ReadPublicToken_IsPublic_NotSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
    Work work = createWork(Visibility.PUBLIC, CLIENT_2);
    orcidSecurityManager.checkAndFilter(ORCID_1, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 28 with Work

use of org.orcid.jaxb.model.record_rc2.Work in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testWork_CantRead_When_DontHaveReadScope_IsLimited_NotSource.

@Test(expected = OrcidAccessControlException.class)
public void testWork_CantRead_When_DontHaveReadScope_IsLimited_NotSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_WORKS_CREATE);
    Work work = createWork(Visibility.LIMITED, CLIENT_2);
    orcidSecurityManager.checkAndFilter(ORCID_1, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
    fail();
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 29 with Work

use of org.orcid.jaxb.model.record_rc2.Work in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testWork_CantRead_When_ReadPublicToken_IsLimited_NotSource.

@Test(expected = OrcidAccessControlException.class)
public void testWork_CantRead_When_ReadPublicToken_IsLimited_NotSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
    Work work = createWork(Visibility.LIMITED, CLIENT_2);
    orcidSecurityManager.checkAndFilter(ORCID_1, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
    fail();
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Example 30 with Work

use of org.orcid.jaxb.model.record_rc2.Work in project ORCID-Source by ORCID.

the class OrcidSecurityManager_generalTest method testWork_CanRead_When_HaveReadScope_IsPublic_NotSource.

@Test
public void testWork_CanRead_When_HaveReadScope_IsPublic_NotSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_WORKS_READ_LIMITED);
    Work work = createWork(Visibility.PUBLIC, CLIENT_2);
    orcidSecurityManager.checkAndFilter(ORCID_1, work, ScopePathType.ORCID_WORKS_READ_LIMITED);
}
Also used : Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Aggregations

Work (org.orcid.jaxb.model.record_v2.Work)150 Test (org.junit.Test)147 ClientResponse (com.sun.jersey.api.client.ClientResponse)52 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)33 DBUnitTest (org.orcid.test.DBUnitTest)24 Response (javax.ws.rs.core.Response)23 Title (org.orcid.jaxb.model.common_v2.Title)22 WorkBulk (org.orcid.jaxb.model.record_v2.WorkBulk)22 Url (org.orcid.jaxb.model.common_v2.Url)21 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)21 OrcidError (org.orcid.jaxb.model.error_v2.OrcidError)19 ArrayList (java.util.ArrayList)16 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)16 BaseTest (org.orcid.core.BaseTest)14 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)13 Work (org.orcid.jaxb.model.record_rc1.Work)12 Work (org.orcid.jaxb.model.record_rc3.Work)11 Work (org.orcid.jaxb.model.record_rc4.Work)11 Funding (org.orcid.jaxb.model.record_v2.Funding)11 BulkElement (org.orcid.jaxb.model.record_v2.BulkElement)9