Search in sources :

Example 16 with Work

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

the class OrcidSecurityManager_generalTest method testWork_CanRead_When_DontHaveReadScope_IsPublic_NotSource.

@Test
public void testWork_CanRead_When_DontHaveReadScope_IsPublic_NotSource() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_WORKS_CREATE);
    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 17 with Work

use of org.orcid.jaxb.model.record_rc1.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 18 with Work

use of org.orcid.jaxb.model.record_rc1.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 19 with Work

use of org.orcid.jaxb.model.record_rc1.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 20 with Work

use of org.orcid.jaxb.model.record_rc1.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)

Aggregations

Test (org.junit.Test)152 Work (org.orcid.jaxb.model.record_v2.Work)151 ClientResponse (com.sun.jersey.api.client.ClientResponse)56 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)35 WorkBulk (org.orcid.jaxb.model.record_v2.WorkBulk)26 DBUnitTest (org.orcid.test.DBUnitTest)25 Response (javax.ws.rs.core.Response)24 Title (org.orcid.jaxb.model.common_v2.Title)24 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)23 Url (org.orcid.jaxb.model.common_v2.Url)22 OrcidError (org.orcid.jaxb.model.error_v2.OrcidError)22 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)17 ArrayList (java.util.ArrayList)16 BaseTest (org.orcid.core.BaseTest)16 BulkElement (org.orcid.jaxb.model.record.bulk.BulkElement)16 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)15 Work (org.orcid.jaxb.model.record_rc1.Work)12 WorkExternalIdentifier (org.orcid.jaxb.model.record_rc1.WorkExternalIdentifier)12 WorkExternalIdentifierId (org.orcid.jaxb.model.record_rc1.WorkExternalIdentifierId)12 Work (org.orcid.jaxb.model.record_rc3.Work)11