Search in sources :

Example 21 with ContributorLicenseAgreement

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";
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 22 with ContributorLicenseAgreement

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";
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) IndividualSignature(io.pivotal.cla.data.IndividualSignature) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 23 with ContributorLicenseAgreement

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);
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) CorporateSignature(io.pivotal.cla.data.CorporateSignature)

Example 24 with ContributorLicenseAgreement

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";
}
Also used : ContributorLicenseAgreement(io.pivotal.cla.data.ContributorLicenseAgreement) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ContributorLicenseAgreement (io.pivotal.cla.data.ContributorLicenseAgreement)24 Test (org.junit.Test)14 AdminListClasPage (io.pivotal.cla.webdriver.pages.admin.AdminListClasPage)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 AdminEditClaPage (io.pivotal.cla.webdriver.pages.admin.AdminEditClaPage)6 CorporateSignature (io.pivotal.cla.data.CorporateSignature)4 AdminCreateClaPage (io.pivotal.cla.webdriver.pages.admin.AdminCreateClaPage)4 IndividualSignature (io.pivotal.cla.data.IndividualSignature)3 MarkdownContent (io.pivotal.cla.data.MarkdownContent)2 ClaPullRequestStatusRequest (io.pivotal.cla.service.ClaPullRequestStatusRequest)2 SignCclaPage (io.pivotal.cla.webdriver.pages.SignCclaPage)2 SignIclaPage (io.pivotal.cla.webdriver.pages.SignIclaPage)2 Date (java.util.Date)2 CorporateSignatureInfo (io.pivotal.cla.service.CorporateSignatureInfo)1 ClaForm (io.pivotal.cla.webdriver.pages.admin.AdminClaFormPage.ClaForm)1 Before (org.junit.Before)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1