use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CclaController method claForm.
@RequestMapping("/sign/{claName}/ccla")
public String claForm(@AuthenticationPrincipal User user, SignCorporateClaForm signCorporateClaForm, Map<String, Object> model) throws Exception {
String claName = signCorporateClaForm.getClaName();
Integer pullRequestId = signCorporateClaForm.getPullRequestId();
String repositoryId = signCorporateClaForm.getRepositoryId();
CorporateSignatureInfo corporateResponse = claService.findCorporateSignatureInfoFor(claName, user);
ContributorLicenseAgreement cla = corporateResponse.getContributorLicenseAgreement();
CorporateSignature signed = corporateResponse.getCorporateSignature();
List<String> currentUserGitHubOrganizations = corporateResponse.getGitHubOrganizations();
if (cla == null) {
throw new ResourceNotFoundException();
}
if (cla.getSupersedingCla() != null) {
cla = cla.getSupersedingCla();
}
signCorporateClaForm.setSigned(signed != null);
signCorporateClaForm.setName(user.getName());
signCorporateClaForm.setClaId(cla.getId());
signCorporateClaForm.setRepositoryId(repositoryId);
signCorporateClaForm.setPullRequestId(pullRequestId);
signCorporateClaForm.setGitHubOrganizations(currentUserGitHubOrganizations);
model.put("cla", cla);
return "cla/ccla/sign";
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class ClaService method hasSigned.
public boolean hasSigned(User user, String claName) {
if (claName == null) {
return false;
}
IndividualSignature signedIndividual = findIndividualSignaturesFor(user, claName);
if (signedIndividual != null) {
return true;
}
CorporateSignatureInfo corporateSignatureInfo = findCorporateSignatureInfoFor(claName, user);
CorporateSignature corporateSignature = corporateSignatureInfo.getCorporateSignature();
return corporateSignature != null;
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignaturesNullEmails.
/**
* Happens in GitHubHooksController when user has not yet authenticated.
*/
@Test
public void findSignaturesNullEmails() {
CorporateSignature emailSignature = createSignature(cla, user);
emailSignature.setGitHubOrganization(null);
emailSignature.setEmailDomain("gmail.com");
emailSignature = signatures.save(emailSignature);
assertThat(signatures.findSignatures(new PageRequest(0, 1), Arrays.asList("notorganization"), null)).isEmpty();
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignatureNullEmails.
/**
* Happens in GitHubHooksController when user has not yet authenticated.
*/
@Test
public void findSignatureNullEmails() {
CorporateSignature emailSignature = createSignature(cla, user);
emailSignature.setGitHubOrganization(null);
emailSignature.setEmailDomain("gmail.com");
emailSignature = signatures.save(emailSignature);
assertThat(signatures.findSignature(springCla.getName(), Arrays.asList("notorganization"), null)).isNull();
}
use of io.pivotal.cla.data.CorporateSignature in project pivotal-cla by pivotalsoftware.
the class CorporateSignatureRepositoryTests method findSignaturesByEmptyGitHubOrganizations.
@Test
public void findSignaturesByEmptyGitHubOrganizations() {
CorporateSignature emailSignature = createSignature(cla, user);
emailSignature.setGitHubOrganization(null);
emailSignature.setEmailDomain("gmail.com");
emailSignature = signatures.save(emailSignature);
assertThat(signatures.findSignatures(new PageRequest(0, 1), Arrays.asList(), null)).isEmpty();
}
Aggregations