use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.
the class IclaController method view.
@RequestMapping("/view/{claName}/icla")
public String view(@PathVariable String claName, Map<String, Object> model) {
ContributorLicenseAgreement cla = clas.findByNameAndPrimaryTrue(claName);
if (cla == null) {
throw new ResourceNotFoundException();
}
if (cla.getSupersedingCla() != null) {
cla = cla.getSupersedingCla();
}
model.put("cla", cla);
return "cla/icla/view";
}
use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.
the class IclaController method claForm.
@RequestMapping("/sign/{claName}/icla")
public String claForm(@AuthenticationPrincipal User user, @ModelAttribute SignClaForm signClaForm, Map<String, Object> model) {
String claName = signClaForm.getClaName();
IndividualSignature signed = claService.findIndividualSignaturesFor(user, claName);
ContributorLicenseAgreement cla = signed == null ? clas.findByNameAndPrimaryTrue(claName) : signed.getCla();
if (cla == null) {
throw new ResourceNotFoundException();
}
if (cla.getSupersedingCla() != null) {
cla = cla.getSupersedingCla();
}
signClaForm.setSigned(signed != null);
signClaForm.setName(user.getName());
signClaForm.setClaId(cla.getId());
model.put("cla", cla);
return "cla/icla/sign";
}
use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.
the class ClaService method findCorporateSignatureInfoFor.
public CorporateSignatureInfo findCorporateSignatureInfoFor(String claName, User user) {
List<String> gitHubOrganizations = gitHub.getOrganizations(user.getGitHubLogin());
CorporateSignature corporateSignature = corporateSignatureRepository.findSignature(claName, gitHubOrganizations, user.getEmails());
ContributorLicenseAgreement contributorLicenseAgreement = corporateSignature == null ? contributorLicenseAgreementRepository.findByNameAndPrimaryTrue(claName) : corporateSignature.getCla();
return new CorporateSignatureInfo(contributorLicenseAgreement, corporateSignature, gitHubOrganizations);
}
use of io.pivotal.cla.data.ContributorLicenseAgreement in project pivotal-cla by pivotalsoftware.
the class ClaController method signIndex.
@RequestMapping("/sign/{claName}")
public String signIndex(@AuthenticationPrincipal User user, @ModelAttribute ClaRequest claRequest, Map<String, Object> model) throws Exception {
String claName = claRequest.getClaName();
Integer pullRequestId = claRequest.getPullRequestId();
String repositoryId = claRequest.getRepositoryId();
ContributorLicenseAgreement cla = clas.findByNameAndPrimaryTrue(claName);
if (cla == null) {
throw new ResourceNotFoundException();
}
boolean signed = user != null && claService.hasSigned(user, claName);
model.put("repositoryId", repositoryId);
model.put("pullRequestId", pullRequestId);
model.put("signed", signed);
model.put("claName", claName);
return "index";
}
Aggregations