Skip to content
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
3 changes: 3 additions & 0 deletions cla-backend-go/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import (
"github.com/linuxfoundation/easycla/cla-backend-go/template"
"github.com/linuxfoundation/easycla/cla-backend-go/user"
v2ClaManager "github.com/linuxfoundation/easycla/cla-backend-go/v2/cla_manager"
v2ClaSearch "github.com/linuxfoundation/easycla/cla-backend-go/v2/cla_search"
v2Company "github.com/linuxfoundation/easycla/cla-backend-go/v2/company"
v2CurrentUser "github.com/linuxfoundation/easycla/cla-backend-go/v2/current_user"
v2Health "github.com/linuxfoundation/easycla/cla-backend-go/v2/health"
Expand Down Expand Up @@ -438,6 +439,7 @@ func server(localMode bool) http.Handler {
gitlabOrganizationsService := gitlab_organizations.NewService(gitlabOrganizationRepo, v2RepositoriesService, v1ProjectClaGroupRepo, storeRepository, usersService, signaturesRepo, v1CompanyRepo)
v1SignaturesService := signatures.NewService(signaturesRepo, v1CompanyService, usersService, eventsService, githubOrgValidation, v1RepositoriesService, githubOrganizationsService, v1ProjectService, gitlabApp, configFile.ClaV1ApiURL, configFile.CLALandingPage, configFile.CLALogoURL)
v2SignatureService := v2Signatures.NewService(awsSession, configFile.SignatureFilesBucket, v1ProjectService, v1CompanyService, v1SignaturesService, v1ProjectClaGroupRepo, signaturesRepo, usersService, approvalsRepo)
v2ClaSearchService := v2ClaSearch.NewService(v2ClaSearch.NewRepository(awsSession, stage))
v2MyClasService := v2MyClas.NewService(v2MyClas.NewRepository(awsSession, stage), user_service.GetClient(), v1SignaturesService, v1CompanyRepo, v1ProjectClaGroupRepo, project_service.GetClient())
trustedCallerVerifier, err := auth.NewTrustedCallerVerifier(configFile.Auth0.Domain, configFile.Auth0.Algorithm, configFile.SelfServe.TrustedClientIDs)
if err != nil {
Expand Down Expand Up @@ -517,6 +519,7 @@ func server(localMode bool) http.Handler {
v2Gerrits.Configure(v2API, gerritService, v1ProjectService, eventsService, v1ProjectClaGroupRepo)
v2Company.Configure(v2API, v2CompanyService, v1ProjectClaGroupRepo, configFile.LFXPortalURL)
v2CurrentUser.Configure(v2API, v2CurrentUserService)
v2ClaSearch.Configure(v2API, v2ClaSearchService)
v2MyClas.Configure(v2API, v2MyClasService, trustedCallerVerifier)
cla_manager.Configure(api, v1ClaManagerService, v1CompanyService, v1ProjectService, usersService, v1SignaturesService, eventsService, emailTemplateService)
v2ClaManager.Configure(v2API, v2ClaManagerService, v1CompanyService, configFile.LFXPortalURL, configFile.CorporateConsoleV2URL, v1ProjectClaGroupRepo, userRepo)
Expand Down
60 changes: 60 additions & 0 deletions cla-backend-go/swagger/cla.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2862,6 +2862,40 @@ paths:
tags:
- my_clas

/cla-group/search:
get:
summary: Search CLA Groups
description: Unscoped search over the CLA Group name, the Salesforce project (or foundation) name, the names of the linked GitHub organizations, GitLab groups and Gerrit instances, and the repository the search term resolves to - a pasted repository URL or a "owner/repo" path is resolved to the CLA Group owning that repository. A URL that names a known repository resolves to that repository's CLA Group only - the owning organization is used as a fallback when no repository record matches - and a URL is matched against the repositories and organizations of the host it names - the forge for a github.com or gitlab.com URL, the host itself for a self-hosted one - while a bare "owner/repo" path matches either forge. Matching is case-insensitive substring matching performed server-side, results are deduplicated by CLA Group and capped at limit. A searchTerm shorter than 3 characters, or a limit outside its bounds, is rejected with a 422; a searchTerm that is shorter than 3 characters only after whitespace trimming is rejected with a 400. The reference data is served from an in-process cache with a short TTL, so a newly added CLA Group, organization or project mapping can take up to the cache TTL (30 minutes by default) to become searchable
operationId: searchClaGroups
parameters:
- $ref: "#/parameters/x-request-id"
- $ref: "#/parameters/x-acl"
- $ref: "#/parameters/x-username"
- $ref: "#/parameters/x-email"
- $ref: "#/parameters/claSearchTerm"
- $ref: "#/parameters/claSearchLimit"
responses:
'200':
description: 'Success'
headers:
x-request-id:
type: string
description: The unique request ID value - assigned/set by the API Gateway based on the session
schema:
$ref: '#/definitions/cla-search-list'
'400':
$ref: '#/responses/invalid-request'
'401':
$ref: '#/responses/unauthorized'
'403':
$ref: '#/responses/forbidden'
'422':
$ref: '#/responses/unprocessable-entity'
'500':
$ref: '#/responses/internal-server-error'
tags:
- cla_search

/user/{userID}/request-company-admin:
post:
summary: Request Manager
Expand Down Expand Up @@ -5036,6 +5070,23 @@ parameters:
type: string
collectionFormat: multi
required: false
claSearchTerm:
name: searchTerm
description: The term to search for - matched case-insensitively as a substring against the CLA Group name, project/foundation name and linked organization names, and resolved as a repository URL or "owner/repo" path
in: query
type: string
minLength: 3
maxLength: 255
required: true
claSearchLimit:
name: limit
description: The maximum number of CLA Groups to return
in: query
type: integer
minimum: 1
maximum: 100
default: 20
required: false

definitions:
# Common definitions
Expand Down Expand Up @@ -5067,6 +5118,15 @@ definitions:
my-identity-list:
$ref: './common/my-identity-list.yaml'

cla-search-list:
$ref: './common/cla-search-list.yaml'

cla-search-result:
$ref: './common/cla-search-result.yaml'

cla-search-org:
$ref: './common/cla-search-org.yaml'

#--------------------------------------
# Docusign Webhook Payload
#____________________________________________
Expand Down
26 changes: 26 additions & 0 deletions cla-backend-go/swagger/common/cla-search-list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT

type: object
x-nullable: false
title: CLA Search List
description: The CLA Groups matching the search term
properties:
searchTerm:
type: string
description: The search term the results were resolved for
resultCount:
type: integer
format: int64
x-omitempty: false
description: The number of results returned - at most limit
truncated:
type: boolean
x-omitempty: false
description: True when more CLA Groups matched than limit and the result set was capped - ask the user to refine the term
results:
type: array
x-omitempty: false
description: The matching CLA Groups, best match first
items:
$ref: '#/definitions/cla-search-result'
18 changes: 18 additions & 0 deletions cla-backend-go/swagger/common/cla-search-org.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT

type: object
x-nullable: false
title: CLA Search Organization
description: A repository-hosting organization (GitHub organization, GitLab group or Gerrit instance) linked to the CLA Group
properties:
name:
type: string
description: The organization/group/Gerrit instance name
source:
type: string
enum: [github, gitlab, gerrit]
description: The repository source hosting the organization
url:
type: string
description: The organization URL, omitted when the source record carries none
53 changes: 53 additions & 0 deletions cla-backend-go/swagger/common/cla-search-result.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT

type: object
x-nullable: false
title: CLA Search Result
description: A CLA Group matching the search term - the CLA Group is the signing unit, so results are deduplicated by claGroupID
properties:
claGroupID:
type: string
description: The CLA Group ID (UUID) - the signing unit, used for the Contributor Console hand-off
claGroupName:
type: string
description: The CLA Group name, omitted when the CLA Group record could not be resolved
projectName:
type: string
description: The Salesforce project display name the CLA Group belongs to (a foundation-level CLA Group resolves to its foundation), omitted when the CLA Group maps to several projects with no foundation marker
projectSFID:
type: string
description: The Salesforce ID of the project in projectName, omitted when projectName could not be resolved
foundationSFID:
type: string
description: The Salesforce ID of the foundation the CLA Group belongs to, omitted when unknown
projectExternalID:
type: string
description: The external (Salesforce) ID stored on the CLA Group record, omitted when unset
iclaEnabled:
type: boolean
x-omitempty: false
description: The project_icla_enabled flag of the CLA Group
cclaEnabled:
type: boolean
x-omitempty: false
description: The project_ccla_enabled flag of the CLA Group
matchTypes:
type: array
x-omitempty: false
description: Why the CLA Group matched, sorted - claGroup (CLA Group name), project (project or foundation name), organization (linked organization name or URL), repository (the search term resolved to a repository)
items:
type: string
enum: [claGroup, project, organization, repository]
organizations:
type: array
x-omitempty: false
description: All repository-hosting organizations linked to the CLA Group, sorted by source then name - carries the repo-source provenance and backs the "N linked orgs" affordance
items:
$ref: '#/definitions/cla-search-org'
matchedRepositoryName:
type: string
description: The full repository name the search term resolved to, set only when matchTypes contains repository
matchedRepositoryURL:
type: string
description: The URL of the repository in matchedRepositoryName, set only when matchTypes contains repository
Loading
Loading