Skip to content

Commit

Permalink
Merge pull request #4414 from nickmango/feature/gerrit-ldap
Browse files Browse the repository at this point in the history
Feature/gerrit ldap
  • Loading branch information
nickmango authored Aug 26, 2024
2 parents ec192c3 + a94dc3a commit bf7b07f
Show file tree
Hide file tree
Showing 18 changed files with 1,067 additions and 844 deletions.
27 changes: 27 additions & 0 deletions cla-backend-go/api_client/api_client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright The Linux Foundation and each contributor to CommunityBridge.
// SPDX-License-Identifier: MIT

package apiclient

import (
"context"
"net/http"
)

type APIClient interface {
GetData(ctx context.Context, url string) (*http.Response, error)
}

type RestAPIClient struct {
Client *http.Client
}

// GetData makes a get request to the specified url

func (c *RestAPIClient) GetData(ctx context.Context, url string) (*http.Response, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return nil, err
}
return c.Client.Do(req)
}
54 changes: 54 additions & 0 deletions cla-backend-go/api_client/mocks/mock_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions cla-backend-go/cmd/dynamo_events_lambda/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,7 @@ func init() {
githubOrganizationsService := github_organizations.NewService(githubOrganizationsRepo, repositoriesRepo, projectClaGroupRepo)
repositoriesService := repositories.NewService(repositoriesRepo, githubOrganizationsRepo, projectClaGroupRepo)

gerritService := gerrits.NewService(gerritRepo, &gerrits.LFGroup{
LfBaseURL: configFile.LFGroup.ClientURL,
ClientID: configFile.LFGroup.ClientID,
ClientSecret: configFile.LFGroup.ClientSecret,
RefreshToken: configFile.LFGroup.RefreshToken,
})
gerritService := gerrits.NewService(gerritRepo)
// Services
projectService := service.NewService(projectRepo, repositoriesRepo, gerritRepo, projectClaGroupRepo, usersRepo)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,7 @@ func Handler(ctx context.Context) error {
v1ProjectClaGroupRepo,
})

gerritService := gerrits.NewService(gerritRepo, &gerrits.LFGroup{
LfBaseURL: configFile.LFGroup.ClientURL,
ClientID: configFile.LFGroup.ClientID,
ClientSecret: configFile.LFGroup.ClientSecret,
RefreshToken: configFile.LFGroup.RefreshToken,
})
gerritService := gerrits.NewService(gerritRepo)

approvalsTableName := "cla-" + stage + "-approvals"

Expand Down
2 changes: 1 addition & 1 deletion cla-backend-go/cmd/migrate_approval_list/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func init() {
v1ProjectClaGroupRepo,
})
ghOrgRepo = github_organizations.NewRepository(awsSession, stage)
gerritService = gerrits.NewService(gerritsRepo, nil)
gerritService = gerrits.NewService(gerritsRepo)
signatureRepo = signatures.NewRepository(awsSession, stage, companyRepo, usersRepo, eventsService, &ghRepo, ghOrgRepo, gerritService, approvalRepo)

log.Info("initialized repositories\n")
Expand Down
8 changes: 1 addition & 7 deletions cla-backend-go/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,7 @@ func server(localMode bool) http.Handler {
v1ProjectClaGroupRepo,
})

gerritService := gerrits.NewService(gerritRepo, &gerrits.LFGroup{
LfBaseURL: configFile.LFGroup.ClientURL,
ClientID: configFile.LFGroup.ClientID,
ClientSecret: configFile.LFGroup.ClientSecret,
RefreshToken: configFile.LFGroup.RefreshToken,
EventsService: eventsService,
})
gerritService := gerrits.NewService(gerritRepo)

// Signature repository handler
signaturesRepo := signatures.NewRepository(awsSession, stage, v1CompanyRepo, usersRepo, eventsService, gitV1Repository, githubOrganizationsRepo, gerritService, approvalsRepo)
Expand Down
143 changes: 143 additions & 0 deletions cla-backend-go/gerrits/mocks/mock_repository.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bf7b07f

Please sign in to comment.