Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix auto enable github issue #4259

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading