Skip to content

Commit

Permalink
[#2792] Feature/Approval Update - invalidate ICLA (#2841)
Browse files Browse the repository at this point in the history
- added icla signature invalidation upon email removal from approval list

Signed-off-by: wanyaland <[email protected]>
  • Loading branch information
wanyaland authored Apr 1, 2021
1 parent 6cbf58b commit 8b7fdfd
Show file tree
Hide file tree
Showing 2 changed files with 22 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 @@ -98,6 +98,7 @@ github.com/communitybridge/easycla v1.0.135 h1:Dvn8jX+7BAnpmA+jvdK0n5ajWP8SoH5vv
github.com/communitybridge/easycla v1.0.145 h1:ikhBSsOeEL2u3/EoyDsufh/j3HkjfFTiXAk1d61GoS8=
github.com/communitybridge/easycla v2.0.10+incompatible h1:6eRJ5fxrMxRZHBkg8piYo+zHTcSowMrP85nZXzp5mpA=
github.com/communitybridge/easycla v2.0.16+incompatible h1:I0hEApDh4IvlwRPyHV1LOsSYlSPbqBsGszjSTHwkdak=
github.com/communitybridge/easycla v2.0.19+incompatible h1:HLaNt3jGDXPh3Au+rW/HKbJNkQf3daboVIrP9G6WYQ4=
github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ=
Expand Down
21 changes: 21 additions & 0 deletions cla-backend-go/signatures/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,27 @@ func (repo repository) UpdateApprovalList(ctx context.Context, claManager *model

repo.eventsService.LogEventWithContext(ctx, eventArgs)

// invalidate icla
log.WithFields(f).Debugf("invalidating icla for user: %s...", email)
claUser, userErr := repo.usersRepo.GetUserByEmail(email)
if userErr != nil {
log.WithFields(f).Debugf("error getting user by email: %s ", email)
}

if claUser != nil {
icla, iclaErr := repo.GetIndividualSignature(ctx, projectID, claUser.UserID)
if iclaErr != nil {
log.WithFields(f).Debugf("unable to get icla signature for user: %s ", email)
}
if icla != nil {
note := fmt.Sprintf("Signature invalidated (approved set to false) by %s due to %s removal ", utils.GetBestUsername(claManager), email)
err := repo.InvalidateProjectRecord(ctx, icla.SignatureID, note)
if err != nil {
log.WithFields(f).Warnf("unable to invalidate record for user:%s ", email)
}
}
}

//update gerrit permissions
gerritUser, err := repo.getGerritUserByEmail(ctx, email, gerritICLAECLAs)
if err != nil || gerritUser == nil {
Expand Down

0 comments on commit 8b7fdfd

Please sign in to comment.