Skip to content

Commit f786536

Browse files
Merge pull request #4485 from communitybridge/lukaszgryglicki-4482-add-embargo_acked-to-cla-signatures
Add support for embargo acknowledgement in python and golang backends
2 parents 8467aec + 9442e3a commit f786536

27 files changed

+173
-142
lines changed

cla-backend-go/signatures/converters.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func (repo repository) buildProjectSignatureModels(ctx context.Context, results
7575
SignatureReferenceNameLower: dbSignature.SignatureReferenceNameLower,
7676
SignatureSigned: dbSignature.SignatureSigned,
7777
SignatureApproved: dbSignature.SignatureApproved,
78+
SignatureEmbargoAcked: dbSignature.SignatureEmbargoAcked,
7879
SignatureDocumentMajorVersion: strconv.Itoa(dbSignature.SignatureDocumentMajorVersion),
7980
SignatureDocumentMinorVersion: strconv.Itoa(dbSignature.SignatureDocumentMinorVersion),
8081
Version: strconv.Itoa(dbSignature.SignatureDocumentMajorVersion) + "." + strconv.Itoa(dbSignature.SignatureDocumentMinorVersion),
@@ -237,6 +238,7 @@ func (repo repository) buildProjectSignatureSummaryModels(ctx context.Context, r
237238
SignatureReferenceNameLower: dbSignature.SignatureReferenceNameLower,
238239
SignatureSigned: dbSignature.SignatureSigned,
239240
SignatureApproved: dbSignature.SignatureApproved,
241+
SignatureEmbargoAcked: dbSignature.SignatureEmbargoAcked,
240242
SignatureReferenceType: dbSignature.SignatureReferenceType,
241243
ProjectID: dbSignature.SignatureProjectID,
242244
SignedOn: dbSignature.SignedOn,

cla-backend-go/signatures/dbmodels.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type ItemSignature struct {
1010
DateModified string `json:"date_modified,omitempty"`
1111
SignatureApproved bool `json:"signature_approved,omitempty"`
1212
SignatureSigned bool `json:"signature_signed"`
13+
SignatureEmbargoAcked bool `json:"signature_embargo_acked,omitempty"`
1314
SignatureDocumentMajorVersion int `json:"signature_document_major_version,omitempty"`
1415
SignatureDocumentMinorVersion int `json:"signature_document_minor_version,omitempty"`
1516
SignatureSignURL string `json:"signature_sign_url,omitempty"`

cla-backend-go/signatures/models.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ type SignatureDynamoDB struct {
9797
SignatureACL []string `json:"signature_acl"` // [github:1234567]
9898
SignatureApproved bool `json:"signature_approved"` // true if the signature is approved, false if revoked/invalidated
9999
SignatureSigned bool `json:"signature_signed"` // true if the signature has been signed
100+
SignatureEmbargoAcked bool `json:"signature_embargo_acked"` // true if the signature's embargo was acknowledged
100101
SignatureReferenceType string `json:"signature_reference_type"` // one of: user, company
101102
SignatureReferenceName string `json:"signature_reference_name"` // John Doe
102103
SignatureReferenceNameLower string `json:"signature_reference_name_lower"` // john doe

cla-backend-go/signatures/repository.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,11 @@ func (repo repository) ValidateProjectRecord(ctx context.Context, signatureID, n
21262126
expressionAttributeValues[":a"] = &dynamodb.AttributeValue{BOOL: aws.Bool(true)}
21272127
updateExpression = updateExpression + " #A = :a,"
21282128

2129+
// Set embago acknowledged flag
2130+
// expressionAttributeNames["#E"] = aws.String("signature_embargo_acked")
2131+
// expressionAttributeValues[":e"] = &dynamodb.AttributeValue{BOOL: aws.Bool(true)}
2132+
// updateExpression = updateExpression + " #E = :e,"
2133+
21292134
expressionAttributeNames["#S"] = aws.String("note")
21302135
expressionAttributeValues[":s"] = &dynamodb.AttributeValue{S: aws.String(note)}
21312136
updateExpression = updateExpression + " #S = :s"
@@ -2527,6 +2532,7 @@ func (repo repository) CreateProjectCompanyEmployeeSignature(ctx context.Context
25272532
SignatureReferenceID: employeeUserModel.UserID,
25282533
SignatureApproved: true,
25292534
SignatureSigned: true,
2535+
SignatureEmbargoAcked: true,
25302536
SignatureDocumentMajorVersion: 2,
25312537
SignatureDocumentMinorVersion: 0,
25322538
SigTypeSignedApprovedID: fmt.Sprintf("ecla#true#true#%s", companyModel.CompanyID),
@@ -4545,6 +4551,7 @@ func (repo repository) getIntermediateICLAResponse(f logrus.Fields, dbSignatures
45454551
LfUsername: sig.UserLFUsername,
45464552
SignatureApproved: sig.SignatureApproved,
45474553
SignatureSigned: sig.SignatureSigned,
4554+
SignatureEmbargoAcked: true,
45484555
SignatureModified: sig.DateModified,
45494556
SignatureID: sig.SignatureID,
45504557
SignedOn: sigSignedTime,
@@ -4928,7 +4935,10 @@ func (repo repository) ActivateSignature(ctx context.Context, signatureID string
49284935
}
49294936

49304937
// Build the expression
4931-
expressionUpdate := expression.Set(expression.Name("signature_approved"), expression.Value(true)).Set(expression.Name("signature_signed"), expression.Value(false))
4938+
expressionUpdate := expression.
4939+
Set(expression.Name("signature_approved"), expression.Value(true)).
4940+
Set(expression.Name("signature_signed"), expression.Value(false)).
4941+
Set(expression.Name("signature_embargo_acked"), expression.Value(true))
49324942

49334943
expr, err := expression.NewBuilder().WithUpdate(expressionUpdate).Build()
49344944
if err != nil {

cla-backend-go/swagger/common/corporate-signature.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ properties:
3838
description: the signature approved flag - true or false value
3939
example: true
4040
x-omitempty: false
41+
signatureEmbargoAcked:
42+
type: boolean
43+
description: the signature embargo acknowledged flag - true or false value
44+
example: true
45+
# x-omitempty: false
4146
signatureReferenceType:
4247
type: string
4348
description: the signature reference type - either user or company

cla-backend-go/swagger/common/icla-signature.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ properties:
5252
description: the signature signed flag - true or false value
5353
example: true
5454
x-omitempty: false
55+
signatureEmbargoAcked:
56+
type: boolean
57+
description: the signature embargo acknowledged flag - true or false value
58+
example: true
59+
# x-omitempty: false
5560
signatureModified:
5661
type: string
5762
description: the signature modified created time

cla-backend-go/swagger/common/signature-summary.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ properties:
2929
description: the signature approved flag - true or false value
3030
example: true
3131
x-omitempty: false
32+
signatureEmbargoAcked:
33+
type: boolean
34+
description: the signature embargo acknowledged flag - true or false value
35+
example: true
36+
# x-omitempty: false
3237
signatureReferenceType:
3338
type: string
3439
description: the signature reference type - either user or company

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ properties:
3838
description: the signature approved flag - true or false value
3939
example: true
4040
x-omitempty: false
41+
signatureEmbargoAcked:
42+
type: boolean
43+
description: the signature embargo acknowledged flag - true or false value
44+
example: true
45+
# x-omitempty: false
4146
signatureReferenceType:
4247
type: string
4348
description: the signature reference type - either user or company

cla-backend-go/v2/company/service_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func TestGetCompanyProjectContributors(t *testing.T) {
3939
SignatureCreated: "2021-09-13T11:59:00.981612+0000",
4040
SignatureApproved: true,
4141
SignatureSigned: true,
42+
SignatureEmbargoAcked: true,
4243
SignatureMajorVersion: "1",
4344
SignatureMinorVersion: "0",
4445
SignatureReferenceID: "signature_reference_id",
@@ -48,6 +49,7 @@ func TestGetCompanyProjectContributors(t *testing.T) {
4849
SignatureCreated: "2021-09-15T11:59:00.981612+0000",
4950
SignatureApproved: true,
5051
SignatureSigned: true,
52+
SignatureEmbargoAcked: true,
5153
SignatureMajorVersion: "1",
5254
SignatureMinorVersion: "0",
5355
SignatureReferenceID: "signature_reference_id",
@@ -57,6 +59,7 @@ func TestGetCompanyProjectContributors(t *testing.T) {
5759
SignatureCreated: "2021-09-14T11:59:00.981612+0000",
5860
SignatureApproved: true,
5961
SignatureSigned: true,
62+
SignatureEmbargoAcked: true,
6063
SignatureMajorVersion: "1",
6164
SignatureMinorVersion: "0",
6265
SignatureReferenceID: "signature_reference_id",
@@ -76,6 +79,7 @@ func TestGetCompanyProjectContributors(t *testing.T) {
7679
SignatureCreated: "2021-09-13T11:59:00.981612+0000",
7780
SignatureApproved: true,
7881
SignatureSigned: true,
82+
SignatureEmbargoAcked: true,
7983
SignatureMajorVersion: "1",
8084
SignatureMinorVersion: "0",
8185
SignatureReferenceID: "signature_reference_id",
@@ -85,6 +89,7 @@ func TestGetCompanyProjectContributors(t *testing.T) {
8589
SignatureCreated: "2021-09-15T11:59:00.981612+0000",
8690
SignatureApproved: true,
8791
SignatureSigned: true,
92+
SignatureEmbargoAcked: true,
8893
SignatureMajorVersion: "1",
8994
SignatureMinorVersion: "0",
9095
SignatureReferenceID: "signature_reference_id",
@@ -94,6 +99,7 @@ func TestGetCompanyProjectContributors(t *testing.T) {
9499
SignatureCreated: "2021-09-14T11:59:00.981612+0000",
95100
SignatureApproved: true,
96101
SignatureSigned: true,
102+
SignatureEmbargoAcked: true,
97103
SignatureMajorVersion: "1",
98104
SignatureMinorVersion: "0",
99105
SignatureReferenceID: "signature_reference_id",
@@ -103,6 +109,7 @@ func TestGetCompanyProjectContributors(t *testing.T) {
103109
SignatureCreated: "",
104110
SignatureApproved: true,
105111
SignatureSigned: true,
112+
SignatureEmbargoAcked: true,
106113
SignatureMajorVersion: "1",
107114
SignatureMinorVersion: "0",
108115
SignatureReferenceID: "signature_reference_id_empty",

cla-backend-go/v2/dynamo_events/cla_manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func (s *service) SetInitialCLAManagerACSPermissions(ctx context.Context, signat
4040
f["projectID"] = sig.ProjectID
4141
f["signed"] = sig.SignatureSigned
4242
f["approved"] = sig.SignatureApproved
43+
f["embargo_acked"] = sig.SignatureEmbargoAcked
4344
f["companyName"] = sig.CompanyName
4445
f["claType"] = sig.ClaType
4546

0 commit comments

Comments
 (0)