use of org.orcid.jaxb.model.record_rc3.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_PersonTest method testPerson_When_AllPrivate_NoSource_ReadPublicToken.
@Test
public void testPerson_When_AllPrivate_NoSource_ReadPublicToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Name name = createName(Visibility.PRIVATE);
Biography bio = createBiography(Visibility.PRIVATE);
Address a1 = createAddress(Visibility.PRIVATE, CLIENT_2);
Address a2 = createAddress(Visibility.PRIVATE, CLIENT_2);
Address a3 = createAddress(Visibility.PRIVATE, CLIENT_2);
Addresses addresses = new Addresses();
addresses.setAddress(new ArrayList<Address>(Arrays.asList(a1, a2, a3)));
Email e1 = createEmail(Visibility.PRIVATE, CLIENT_2);
Email e2 = createEmail(Visibility.PRIVATE, CLIENT_2);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
Emails emails = new Emails();
emails.setEmails(new ArrayList<Email>(Arrays.asList(e1, e2, e3)));
Keyword k1 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keyword k2 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keyword k3 = createKeyword(Visibility.PRIVATE, CLIENT_2);
Keywords keywords = new Keywords();
keywords.setKeywords(new ArrayList<Keyword>(Arrays.asList(k1, k2, k3)));
OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
OtherNames otherNames = new OtherNames();
otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
PersonExternalIdentifier ext1 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifier ext2 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifier ext3 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
PersonExternalIdentifiers extIds = new PersonExternalIdentifiers();
extIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(Arrays.asList(ext1, ext2, ext3)));
ResearcherUrl r1 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrl r2 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrl r3 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
ResearcherUrls researcherUrls = new ResearcherUrls();
researcherUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(Arrays.asList(r1, r2, r3)));
Person p = new Person();
p.setBiography(bio);
p.setName(name);
p.setAddresses(addresses);
p.setEmails(emails);
p.setExternalIdentifiers(extIds);
p.setKeywords(keywords);
p.setOtherNames(otherNames);
p.setResearcherUrls(researcherUrls);
orcidSecurityManager.checkAndFilter(ORCID_1, p);
assertNotNull(p);
assertNull(p.getName());
assertNull(p.getBiography());
// Check addresses
assertEquals(0, p.getAddresses().getAddress().size());
// Check emails
assertEquals(0, p.getEmails().getEmails().size());
// Check ext ids
assertEquals(0, p.getExternalIdentifiers().getExternalIdentifiers().size());
// Check keywords
assertEquals(0, p.getKeywords().getKeywords().size());
// Check other names
assertEquals(0, p.getOtherNames().getOtherNames().size());
// Check researcher urls
assertEquals(0, p.getResearcherUrls().getResearcherUrls().size());
}
use of org.orcid.jaxb.model.record_rc3.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testName_CantRead_When_HaveReadScope_IsPrivate.
@Test(expected = OrcidVisibilityException.class)
public void testName_CantRead_When_HaveReadScope_IsPrivate() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
Name name = createName(Visibility.PRIVATE);
orcidSecurityManager.checkAndFilter(ORCID_1, name, ScopePathType.ORCID_BIO_READ_LIMITED);
fail();
}
use of org.orcid.jaxb.model.record_rc3.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testPersonalDetails_When_SomeLimited_ReadPublicToken.
@Test
public void testPersonalDetails_When_SomeLimited_ReadPublicToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Name name = createName(Visibility.LIMITED);
Biography bio = createBiography(Visibility.PUBLIC);
OtherName o1 = createOtherName(Visibility.LIMITED, CLIENT_2);
OtherName o2 = createOtherName(Visibility.PUBLIC, CLIENT_2);
OtherName o3 = createOtherName(Visibility.LIMITED, CLIENT_2);
OtherNames otherNames = new OtherNames();
otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
PersonalDetails p = new PersonalDetails();
p.setBiography(bio);
p.setName(name);
p.setOtherNames(otherNames);
orcidSecurityManager.checkAndFilter(ORCID_1, p);
assertNotNull(p);
assertNull(p.getName());
assertEquals(bio, p.getBiography());
assertNotNull(p.getOtherNames());
assertNotNull(p.getOtherNames().getOtherNames());
assertEquals(1, p.getOtherNames().getOtherNames().size());
assertFalse(p.getOtherNames().getOtherNames().contains(o1));
assertTrue(p.getOtherNames().getOtherNames().contains(o2));
assertFalse(p.getOtherNames().getOtherNames().contains(o3));
}
use of org.orcid.jaxb.model.record_rc3.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testName_CantRead_When_DontHaveReadScope_IsLimited.
@Test(expected = OrcidAccessControlException.class)
public void testName_CantRead_When_DontHaveReadScope_IsLimited() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_UPDATE);
Name name = createName(Visibility.LIMITED);
orcidSecurityManager.checkAndFilter(ORCID_1, name, ScopePathType.ORCID_BIO_READ_LIMITED);
fail();
}
use of org.orcid.jaxb.model.record_rc3.Name in project ORCID-Source by ORCID.
the class OrcidSecurityManager_generalTest method testName_CanRead_When_HaveReadScope_IsPublic.
@Test
public void testName_CanRead_When_HaveReadScope_IsPublic() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.ORCID_BIO_READ_LIMITED);
Name name = createName(Visibility.PUBLIC);
orcidSecurityManager.checkAndFilter(ORCID_1, name, ScopePathType.ORCID_BIO_READ_LIMITED);
}
Aggregations