Search in sources :

Example 51 with Emails

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));
}
Also used : Email(org.orcid.jaxb.model.v3.dev1.record.Email) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 52 with Emails

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));
}
Also used : Email(org.orcid.jaxb.model.v3.dev1.record.Email) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 53 with Emails

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));
}
Also used : Email(org.orcid.jaxb.model.v3.dev1.record.Email) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 54 with Emails

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));
}
Also used : Email(org.orcid.jaxb.model.v3.dev1.record.Email) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 55 with Emails

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));
}
Also used : Email(org.orcid.jaxb.model.v3.dev1.record.Email) ArrayList(java.util.ArrayList) Emails(org.orcid.jaxb.model.v3.dev1.record.Emails) Person(org.orcid.jaxb.model.v3.dev1.record.Person) Test(org.junit.Test)

Aggregations

Email (org.orcid.jaxb.model.v3.dev1.record.Email)59 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)56 Test (org.junit.Test)54 Address (org.orcid.jaxb.model.v3.dev1.record.Address)33 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)32 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)32 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)32 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)32 Person (org.orcid.jaxb.model.v3.dev1.record.Person)32 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)32 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)32 Addresses (org.orcid.jaxb.model.v3.dev1.record.Addresses)31 Keywords (org.orcid.jaxb.model.v3.dev1.record.Keywords)31 PersonExternalIdentifiers (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers)31 ResearcherUrls (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls)31 Name (org.orcid.jaxb.model.v3.dev1.record.Name)27 Record (org.orcid.jaxb.model.v3.dev1.record.Record)15 ArrayList (java.util.ArrayList)13 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)13 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)13