use of org.orcid.jaxb.model.v3.dev1.record.Emails in project ORCID-Source by ORCID.
the class OrcidSecurityManager_EmailTest method testEmail_NoSource_AllPrivate_ReadPrivateEmail.
@Test
public void testEmail_NoSource_AllPrivate_ReadPrivateEmail() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.EMAIL_READ_PRIVATE);
Email e1 = createEmail(Visibility.PRIVATE, CLIENT_2);
Email e2 = createEmail(Visibility.PRIVATE, CLIENT_2);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
List<Email> emails = new ArrayList<Email>(Arrays.asList(e1, e2, e3));
orcidSecurityManager.checkAndFilter(ORCID_1, emails, ScopePathType.ORCID_BIO_READ_LIMITED);
assertEquals(3, emails.size());
assertTrue(emails.contains(e1));
assertTrue(emails.contains(e2));
assertTrue(emails.contains(e3));
}
use of org.orcid.jaxb.model.v3.dev1.record.Emails in project ORCID-Source by ORCID.
the class OrcidSecurityManager_EmailTest method testEmail_NoSource_ReadPublic.
@Test
public void testEmail_NoSource_ReadPublic() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Email e1 = createEmail(Visibility.PUBLIC, CLIENT_2);
Email e2 = createEmail(Visibility.LIMITED, CLIENT_2);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
List<Email> emails = new ArrayList<Email>(Arrays.asList(e1, e2, e3));
orcidSecurityManager.checkAndFilter(ORCID_1, emails, ScopePathType.ORCID_BIO_READ_LIMITED);
assertEquals(1, emails.size());
assertTrue(emails.contains(e1));
assertFalse(emails.contains(e2));
assertFalse(emails.contains(e3));
}
use of org.orcid.jaxb.model.v3.dev1.record.Emails in project ORCID-Source by ORCID.
the class OrcidSecurityManager_EmailTest method testEmail_SourceOfPrivate_ReadPublic.
@Test
public void testEmail_SourceOfPrivate_ReadPublic() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Email e1 = createEmail(Visibility.PUBLIC, CLIENT_2);
Email e2 = createEmail(Visibility.LIMITED, CLIENT_2);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_1);
List<Email> emails = new ArrayList<Email>(Arrays.asList(e1, e2, e3));
orcidSecurityManager.checkAndFilter(ORCID_1, emails, ScopePathType.ORCID_BIO_READ_LIMITED);
assertEquals(2, emails.size());
assertTrue(emails.contains(e1));
assertFalse(emails.contains(e2));
assertTrue(emails.contains(e3));
}
use of org.orcid.jaxb.model.v3.dev1.record.Emails in project ORCID-Source by ORCID.
the class OrcidSecurityManager_EmailTest method testEmail_SourceOfALL_ReadPublic.
@Test
public void testEmail_SourceOfALL_ReadPublic() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Email e1 = createEmail(Visibility.PUBLIC, CLIENT_1);
Email e2 = createEmail(Visibility.LIMITED, CLIENT_1);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_1);
List<Email> emails = new ArrayList<Email>(Arrays.asList(e1, e2, e3));
orcidSecurityManager.checkAndFilter(ORCID_1, emails, ScopePathType.ORCID_BIO_READ_LIMITED);
assertEquals(3, emails.size());
assertTrue(emails.contains(e1));
assertTrue(emails.contains(e2));
assertTrue(emails.contains(e3));
}
use of org.orcid.jaxb.model.v3.dev1.record.Emails in project ORCID-Source by ORCID.
the class OrcidSecurityManager_EmailTest method testPerson_NoReadLimited.
@Test
public void testPerson_NoReadLimited() {
SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_PUBLIC);
Email e1 = createEmail(Visibility.PUBLIC, CLIENT_2);
Email e2 = createEmail(Visibility.LIMITED, CLIENT_2);
Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
List<Email> emailList = new ArrayList<Email>(Arrays.asList(e1, e2, e3));
Emails emails = new Emails();
emails.setEmails(emailList);
Person p = new Person();
p.setEmails(emails);
orcidSecurityManager.checkAndFilter(ORCID_1, p);
assertNotNull(p);
assertNotNull(p.getEmails());
assertEquals(1, p.getEmails().getEmails().size());
assertTrue(p.getEmails().getEmails().contains(e1));
assertFalse(p.getEmails().getEmails().contains(e2));
assertFalse(p.getEmails().getEmails().contains(e3));
}
Aggregations