use of org.orcid.core.exception.OrcidAccessControlException in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegatorImpl method viewEmails.
@Override
public Response viewEmails(String orcid) {
Emails emails = null;
try {
// return all emails if client has /email/read-private scope
orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.EMAIL_READ_PRIVATE);
emails = emailManagerReadOnly.getEmails(orcid);
// Lets copy the list so we don't modify the cached collection
List<Email> filteredList = new ArrayList<Email>(emails.getEmails());
emails = new Emails();
emails.setEmails(filteredList);
} catch (OrcidAccessControlException e) {
emails = emailManagerReadOnly.getEmails(orcid);
// Lets copy the list so we don't modify the cached collection
List<Email> filteredList = new ArrayList<Email>(emails.getEmails());
emails = new Emails();
emails.setEmails(filteredList);
// Filter just in case client doesn't have the /email/read-private
// scope
orcidSecurityManager.checkAndFilter(orcid, emails.getEmails(), ScopePathType.ORCID_BIO_READ_LIMITED);
}
ElementUtils.setPathToEmail(emails, orcid);
Api3_0_Dev1LastModifiedDatesHelper.calculateLastModified(emails);
sourceUtils.setSourceName(emails);
return Response.ok(emails).build();
}
Aggregations