Skip to content

Commit fdf1181

Browse files
Merge branch 'dev' into dependabot/pip/cla-backend/python-jose-3.4.0
2 parents 8fd7ca5 + 7471b1d commit fdf1181

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+804
-37
lines changed

CHECK_PR.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# How to check why EasyCLA is not covered
2+
3+
1) Open GitHub PR and check for user name: `` select * from FIVETRAN_INGEST.DYNAMODB_PRODUCT_US_EAST_1.CLA_PROD_USERS where data:user_github_username = '<user-name>'; ``. Note `user_id`.
4+
2) If user has `user_company_id` then note it and get company data: `` select * from FIVETRAN_INGEST.DYNAMODB_PRODUCT_US_EAST_1.CLA_PROD_COMPANIES where company_id = '<user-company-id>'; ``.
5+
3) First let's look for ICLAs: `` select * from FIVETRAN_INGEST.DYNAMODB_PRODUCT_US_EAST_1.CLA_PROD_SIGNATURES where data:signature_reference_id = '<user-id>' and data:signature_reference_type = 'user' and data:signature_type = 'cla' and data:signature_user_ccla_company_id is null; ``.
6+
4) If ICLAs are found, then check for which project `data:signature_project_id` field: `` select data:project_name from FIVETRAN_INGEST.DYNAMODB_PRODUCT_US_EAST_1.CLA_PROD_PROJECTS where project_id = '<project-id>'; ``.
7+
5) For ECLA (if user have `company_id` set), lookup for ECLAs: `` select * from FIVETRAN_INGEST.DYNAMODB_PRODUCT_US_EAST_1.CLA_PROD_SIGNATURES where data:signature_project_id = '<project-id>' and data:signature_user_ccla_company_id = '<user-company-id>' and data:signature_reference_id = '<user-id>'; ``.
8+
6) To find comapny's / project's CCLA: `` select * from FIVETRAN_INGEST.DYNAMODB_PRODUCT_US_EAST_1.CLA_PROD_SIGNATURES where data:signature_project_id = '<project-id>' and data:signature_reference_id = '<company-id>' and data:signature_reference_type = 'company'; ``.

cla-backend-go/auth/authorizer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func (a Authorizer) SecurityAuth(token string, scopes []string) (*user.CLAUser,
7272
f["claims"] = fmt.Sprintf("%+v", claims)
7373

7474
// Get the username from the token claims
75+
// LG: for V3 endpoints comment this out and set: username, name and email manually for local testing.
7576
usernameClaim, ok := claims[a.authValidator.usernameClaim]
7677
if !ok {
7778
log.WithFields(f).Warnf("username not found in claims with key: %s", a.authValidator.usernameClaim)

cla-backend-go/cmd/zipbuilder_lambda/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ func main() {
102102
log.Info("Lambda server starting...")
103103
printBuildInfo()
104104
if os.Getenv("LOCAL_MODE") == "true" {
105-
if len(os.Args) != 3 {
106-
log.Fatal("invalid number of args. first arg should be icla or ccla and 2nd arg should be cla_group_id")
105+
if len(os.Args) != 4 {
106+
log.Fatal("invalid number of args. first arg should be icla or ccla, 2nd should be pdf or csv and 3rd arg should be cla_group_id")
107107
}
108-
err := handler(utils.NewContext(), BuildZipEvent{SignatureType: os.Args[1], ClaGroupID: os.Args[2]})
108+
err := handler(utils.NewContext(), BuildZipEvent{SignatureType: os.Args[1], FileType: os.Args[2], ClaGroupID: os.Args[3]})
109109
if err != nil {
110110
log.Fatal(err)
111111
}

cla-backend-go/cmd/zipbuilder_scheduler_lambda/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ func handler(ctx context.Context, event events.CloudWatchEvent) {
114114

115115
func invokeLambda(wg *sync.WaitGroup, lambdaClient *lambda.Lambda, stage string, buildZipEvent BuildZipEvent) {
116116
defer wg.Done()
117-
log.WithField("buildZipEvent", buildZipEvent).Debug("invoking zipbuilder-lambda")
117+
log.WithField("buildZipEvent", buildZipEvent).Debug("invoking zip-builder-lambda")
118118
payload, err := json.Marshal(buildZipEvent)
119119
if err != nil {
120120
log.Error("Error marshalling BuildZip request", err)
121121
return
122122
}
123-
functionName := fmt.Sprintf("cla-backend-%s-zipbuilder-lambda", stage)
123+
functionName := fmt.Sprintf("cla-backend-%s-zip-builder-lambda", stage)
124124

125125
_, err = lambdaClient.Invoke(&lambda.InvokeInput{FunctionName: aws.String(functionName), Payload: payload})
126126
if err != nil {

cla-backend-go/company/models.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ type DBModel struct {
2424
Created string `dynamodbav:"date_created" json:"date_created"`
2525
Updated string `dynamodbav:"date_modified" json:"date_modified"`
2626
Note string `dynamodbav:"note" json:"note"`
27+
IsSanctioned bool `dynamodbav:"is_sanctioned" json:"is_sanctioned"`
2728
Version string `dynamodbav:"version" json:"version"`
2829
}
2930

@@ -85,6 +86,7 @@ func (dbCompanyModel *DBModel) toModel() (*models.Company, error) {
8586
Created: strfmt.DateTime(createdDateTime),
8687
Updated: strfmt.DateTime(updateDateTime),
8788
Note: dbCompanyModel.Note,
89+
IsSanctioned: dbCompanyModel.IsSanctioned,
8890
Version: dbCompanyModel.Version,
8991
}, nil
9092
}
@@ -145,6 +147,7 @@ func toSwaggerModel(dbCompanyModel *DBModel) (*models.Company, error) {
145147
CompanyID: dbCompanyModel.CompanyID,
146148
CompanyName: dbCompanyModel.CompanyName,
147149
SigningEntityName: dbCompanyModel.SigningEntityName,
150+
IsSanctioned: dbCompanyModel.IsSanctioned,
148151
CompanyExternalID: dbCompanyModel.CompanyExternalID,
149152
CompanyManagerID: dbCompanyModel.CompanyManagerID,
150153
Created: strfmt.DateTime(createdDateTime),

cla-backend-go/company/projections.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func buildCompanyProjection() expression.ProjectionBuilder {
1818
expression.Name("date_created"),
1919
expression.Name("date_modified"),
2020
expression.Name("note"),
21+
expression.Name("is_sanctioned"),
2122
expression.Name("version"),
2223
)
2324
}

cla-backend-go/company/repository.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ func (repo repository) buildCompaniesByUserManagerWithInvites(ctx context.Contex
733733
for _, invite := range invites {
734734
company, err := repo.GetCompany(ctx, invite.RequestedCompanyID)
735735
if err != nil {
736-
log.WithFields(f).Warnf("error retrieving company with company ID %s, error: %v - skipping invite", company, err)
736+
log.WithFields(f).Warnf("error retrieving company with company ID %s, error: %v - skipping invite", invite.RequestedCompanyID, err)
737737
continue
738738
}
739739

@@ -772,6 +772,8 @@ func buildCompanyModels(ctx context.Context, results *dynamodb.ScanOutput) ([]mo
772772
CompanyACL []string `json:"company_acl"`
773773
CompanyExternalID string `json:"company_external_id"`
774774
Created string `json:"date_created"`
775+
Note string `json:"note"`
776+
IsSanctioned bool `json:"is_sanctioned"`
775777
Modified string `json:"date_modified"`
776778
}
777779

@@ -812,6 +814,8 @@ func buildCompanyModels(ctx context.Context, results *dynamodb.ScanOutput) ([]mo
812814
SigningEntityName: dbCompany.SigningEntityName,
813815
CompanyExternalID: dbCompany.CompanyExternalID,
814816
Created: strfmt.DateTime(createdDateTime),
817+
Note: dbCompany.Note,
818+
IsSanctioned: dbCompany.IsSanctioned,
815819
Updated: strfmt.DateTime(modifiedDateTime),
816820
})
817821
}
@@ -1269,6 +1273,7 @@ func (repo repository) CreateCompany(ctx context.Context, in *models.Company) (*
12691273
utils.XREQUESTID: ctx.Value(utils.XREQUESTID),
12701274
"companyName": in.CompanyName,
12711275
"signingEntityName": in.SigningEntityName,
1276+
"isSanctioned": in.IsSanctioned,
12721277
"companySFID": in.CompanyExternalID,
12731278
}
12741279

@@ -1296,6 +1301,7 @@ func (repo repository) CreateCompany(ctx context.Context, in *models.Company) (*
12961301
CompanyName: in.CompanyName,
12971302
CompanyExternalID: in.CompanyExternalID,
12981303
SigningEntityName: in.SigningEntityName,
1304+
IsSanctioned: in.IsSanctioned,
12991305
Created: now,
13001306
Updated: now,
13011307
Version: "v1",

cla-backend-go/company/service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ func (s service) CreateOrgFromExternalID(ctx context.Context, signingEntityName,
878878
CompanyExternalID: org.ID,
879879
CompanyName: org.Name,
880880
SigningEntityName: signingEntityName,
881+
IsSanctioned: false,
881882
Note: fmt.Sprintf("%s - Created based on SF Organization Service record - %s", now, additionalNote),
882883
}
883884
if companyAdmin != nil {

cla-backend-go/swagger/common/company.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ properties:
3838
type: string
3939
description: An optional note associated with this company record
4040
example: "Added by David to support CNCF migration"
41+
isSanctioned:
42+
type: boolean
43+
description: "Is this company OFAC sanctioned?"
44+
# default: false
45+
example: true
4146
version:
4247
type: string
4348
description: 'the version of the company record'

cla-backend-go/swagger/common/user.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@ properties:
5757
userCompanyID:
5858
type: string
5959
description: the user's optional company ID
60+
isSanctioned:
61+
type: boolean
62+
description: "Is this user OFAC sanctioned? This field comes from users's company"
63+
# default: false
64+
example: true

0 commit comments

Comments
 (0)