Skip to content

Commit

Permalink
fix: set policy version appropriately after roleset bindings have cha…
Browse files Browse the repository at this point in the history
…nged (#93)
  • Loading branch information
austingebauer committed Jul 27, 2020
1 parent 6c617f9 commit 306f002
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugin/iamutil/api_handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ func verifyIamResource_GetSetPolicy(t *testing.T, resourceType string,
Email: creds.ClientEmail,
})

if p.Version != newP.Version {
t.Fatalf("expected policy version %d after adding bindings, got %d", p.Version, newP.Version)
}

if err != nil {
t.Fatalf("could not get IAM Policy for resource type '%s': %v", resourceType, err)
}
Expand Down
1 change: 1 addition & 0 deletions plugin/iamutil/iam_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (p *Policy) ChangedBindings(toAdd *PolicyDelta, toRemove *PolicyDelta) (cha
return true, &Policy{
Bindings: newBindings,
Etag: p.Etag,
Version: p.Version,
}
}
return false, p
Expand Down

0 comments on commit 306f002

Please sign in to comment.