Skip to content

Commit

Permalink
Merge pull request #4259 from communitybridge/fix/gh_repo_autoenable_…
Browse files Browse the repository at this point in the history
…issue

fix auto enable github issue
  • Loading branch information
nickmango authored Feb 27, 2024
2 parents 2f29b52 + af22493 commit f552e1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions cla-backend-go/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ func server(localMode bool) http.Handler {
sign.Configure(v2API, v2SignService, usersService)
v2GithubActivity.Configure(v2API, v2GithubActivityService)

v2API.AddMiddlewareFor("POST", "/signed/individual/{installation_id}/{github_repository_id}/{change_request_id}", sign.DocusignMiddleware)
v2API.AddMiddlewareFor("POST", "/signed/corporate/{project_id}/{company_id}", sign.CCLADocusignMiddleware)
v2API.AddMiddlewareFor("POST", "/signed/gitlab/individual/{user_id}/{organization_id}/{gitlab_repository_id}/{merge_request_id}", sign.DocusignMiddleware)
v2API.AddMiddlewareFor("POST", "/signed/gerrit/individual/{user_id}", sign.DocusignMiddleware)

userCreaterMiddleware := func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
createUserFromRequest(authorizer, usersService, eventsService, r)
Expand Down
11 changes: 4 additions & 7 deletions cla-backend-go/v2/sign/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var (
cclaDocusignPayload []byte
)

// docusignMiddleware is used to get access to xml request body
func docusignMiddleware(next http.Handler) http.Handler {
// DocusignMiddleware is used to get access to xml request body
func DocusignMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
f := logrus.Fields{
"functionName": "v2.sign.handlers.docusignMiddleware",
Expand All @@ -53,7 +53,8 @@ func docusignMiddleware(next http.Handler) http.Handler {
})
}

func cclaDocusignMiddleware(next http.Handler) http.Handler {
// CCLADocusignMiddleware used to set CCLA middleware
func CCLADocusignMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
f := logrus.Fields{
"functionName": "v2.sign.handlers.cclaDocusignMiddleware",
Expand Down Expand Up @@ -243,10 +244,6 @@ func Configure(api *operations.EasyclaAPI, service Service, userService users.Se
return sign.NewCclaCallbackOK()
})

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

0 comments on commit f552e1c

Please sign in to comment.