Skip to content

Commit

Permalink
Merge pull request #4241 from nickmango/feature/gerrit-docusign-flow
Browse files Browse the repository at this point in the history
[#4002] Feature/Gerrit Sign
  • Loading branch information
nickmango authored Feb 10, 2024
2 parents 2e6bfc1 + ae5163f commit cf7e24d
Show file tree
Hide file tree
Showing 3 changed files with 343 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cla-backend-go/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func server(localMode bool) http.Handler {
v2GithubActivityService := v2GithubActivity.NewService(gitV1Repository, githubOrganizationsRepo, eventsService, autoEnableService, emailService)

v2ClaGroupService := cla_groups.NewService(v1ProjectService, templateService, v1ProjectClaGroupRepo, v1ClaManagerService, v1SignaturesService, metricsRepo, gerritService, v1RepositoriesService, eventsService)
v2SignService := sign.NewService(configFile.ClaAPIV4Base, configFile.ClaV1ApiURL, v1CompanyRepo, v1CLAGroupRepo, v1ProjectClaGroupRepo, v1CompanyService, v2ClaGroupService, configFile.DocuSignPrivateKey, usersService, v1SignaturesService, storeRepository, v1RepositoriesService, githubOrganizationsService, gitlabOrganizationsService, configFile.CLALandingPage, configFile.CLALogoURL, emailService, eventsService, gitlabActivityService, gitlabApp)
v2SignService := sign.NewService(configFile.ClaAPIV4Base, configFile.ClaV1ApiURL, v1CompanyRepo, v1CLAGroupRepo, v1ProjectClaGroupRepo, v1CompanyService, v2ClaGroupService, configFile.DocuSignPrivateKey, usersService, v1SignaturesService, storeRepository, v1RepositoriesService, githubOrganizationsService, gitlabOrganizationsService, configFile.CLALandingPage, configFile.CLALogoURL, emailService, eventsService, gitlabActivityService, gitlabApp, gerritService)

sessionStore, err := dynastore.New(dynastore.Path("/"), dynastore.HTTPOnly(), dynastore.TableName(configFile.SessionStoreTableName), dynastore.DynamoDB(dynamodb.New(awsSession)))
if err != nil {
Expand Down
9 changes: 2 additions & 7 deletions cla-backend-go/v2/sign/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package sign
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -219,13 +218,8 @@ func Configure(api *operations.EasyclaAPI, service Service, userService users.Se
}

log.WithFields(f).Debug("gerrit callback")
payload, marshalErr := json.Marshal(params.Body)
if marshalErr != nil {
log.WithFields(f).WithError(marshalErr).Warn("unable to marshal github callback body")
return sign.NewIclaCallbackGithubBadRequest()
}

err := service.SignedIndividualCallbackGerrit(ctx, payload, params.UserID)
err := service.SignedIndividualCallbackGerrit(ctx, iclaGitHubPayload, params.UserID)
if err != nil {
return sign.NewIclaCallbackGerritBadRequest()
}
Expand All @@ -252,6 +246,7 @@ func Configure(api *operations.EasyclaAPI, service Service, userService users.Se
api.AddMiddlewareFor("POST", "/signed/individual/{installation_id}/{github_repository_id}/{change_request_id}", docusignMiddleware)
api.AddMiddlewareFor("POST", "/signed/corporate/{project_id}/{company_id}", cclaDocusignMiddleware)
api.AddMiddlewareFor("POST", "/signed/gitlab/individual/{user_id}/{organization_id}/{gitlab_repository_id}/{merge_request_id}", docusignMiddleware)
api.AddMiddlewareFor("POST", "/signed/gerrit/individual/{user_id}", docusignMiddleware)
}

type codedResponse interface {
Expand Down
Loading

0 comments on commit cf7e24d

Please sign in to comment.