Skip to content

Commit

Permalink
[#2515] Feature/ Company Project CLA (#2521)
Browse files Browse the repository at this point in the history
- Added company_id and signatureACL to response

Signed-off-by: wanyaland <[email protected]>
  • Loading branch information
wanyaland authored Jan 25, 2021
1 parent 997dd96 commit 8742a10
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions cla-backend-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/communitybridge/easycla v1.0.99 h1:PkmkMV7cLH2Q2YNSFiGGmlyrHBXVYdsWMwbXNuMAyqw=
github.com/communitybridge/easycla v1.0.106 h1:NLYUZUZtp9DQ0dHEQkhz9h9EMzLRmuh9udsPZk8oLoQ=
github.com/communitybridge/easycla v1.0.107 h1:dktHAji1yJ1nMEu54z4paPWOM4Q7A9rryc0OCADfAcY=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
Expand Down
6 changes: 6 additions & 0 deletions cla-backend-go/swagger/cla.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4494,6 +4494,8 @@ definitions:
description: The company signing entity name
x-omitempty: false
example: "The Linux Foundation Subsidiary 1"
signing_entity_id:
$ref: './common/properties/internal-id.yaml'
cla_group_id:
type: string
x-omitempty: false
Expand Down Expand Up @@ -4539,6 +4541,10 @@ definitions:
description: The company signing entity name
x-omitempty: false
example: "The Linux Foundation Subsidiary 1"
signing_entity_id:
$ref: './common/properties/internal-id.yaml'
signature_acl:
$ref: './common/signature-acl.yaml'
signed_on:
type: string
x-omitempty: false
Expand Down
10 changes: 10 additions & 0 deletions cla-backend-go/swagger/common/signature-acl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT

type: object
title: signature acl list representing cla managers access list
properties:
username_list:
type: array
items:
type: string
23 changes: 23 additions & 0 deletions cla-backend-go/v2/company/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ func (s *service) GetCompanyProjectCLA(ctx context.Context, authUser *auth.User,
unsignedProject := &models.UnsignedProject{
CompanyName: company.CompanyName,
SigningEntityName: company.SigningEntityName,
SigningEntityID: company.CompanyID,
CanSign: canSign,
ClaGroupID: claGroupID,
ClaGroupName: claGroup.ClaGroupName,
Expand All @@ -825,6 +826,13 @@ func (s *service) GetCompanyProjectCLA(ctx context.Context, authUser *auth.User,
companyProjectCLA.UnsignedProjectList = append(companyProjectCLA.UnsignedProjectList, unsignedProject)
}
companyProjectClaList = append(companyProjectClaList, companyProjectCLA)

// refresh clagroups for next company instance
claGroups, err = s.getCLAGroupsUnderProjectOrFoundation(ctx, projectSFID)
if err != nil {
log.WithFields(f).Warnf("problem fetching CLA Groups under project or foundation, error: %+v", err)
return nil, err
}
}

return &models.CompanyProjectClaList{
Expand Down Expand Up @@ -1114,6 +1122,17 @@ func (s *service) fillActiveCLA(ctx context.Context, wg *sync.WaitGroup, sig *v1
return
}

// Update acl
var acl = make([]string, 0)
if len(sig.SignatureACL) > 0 {
log.WithFields(f).Debugf("updating signature acl: %+v list for lfusernames...", sig.SignatureACL)
for _, manager := range sig.SignatureACL {
if manager.LfUsername != "" {
acl = append(acl, manager.LfUsername)
}
}
}

// fill details from dynamodb
activeCla.CompanyName = company.CompanyName
if company.SigningEntityName == "" {
Expand All @@ -1127,6 +1146,10 @@ func (s *service) fillActiveCLA(ctx context.Context, wg *sync.WaitGroup, sig *v1
} else {
activeCla.SignedOn = sig.SignedOn
}
activeCla.SigningEntityID = companyID
activeCla.SignatureACL = &models.ActiveClaSignatureACL{
UsernameList: acl,
}
activeCla.ClaGroupName = cg.ClaGroupName
activeCla.SignatureID = sig.SignatureID.String()

Expand Down

0 comments on commit 8742a10

Please sign in to comment.