Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: validing iam bindings (#6078)
p0ny2a57156a7934
diff --git a/backend/api/v1/project_service.go b/backend/api/v1/project_service.goindex 2bf81c98fe..6f32cdb12d 100644--- a/backend/api/v1/project_service.go+++ b/backend/api/v1/project_service.go@@ -1229,12 +1229,8 @@ func validateBindings(bindings []*v1pb.Binding, roles []*v1pb.Role) error {if len(binding.Members) == 0 {return errors.Errorf("Each IAM binding must have at least one member")}- // We have not merge the binding by the same role yet, so the roles in each binding must be unique.- if _, ok := projectRoleMap[binding.Role]; ok {- return errors.Errorf("Each IAM binding must have a unique role")- }- // Users with each role must be unique.+ // Users within each binding must be unique.userMap := make(map[string]bool)for _, member := range binding.Members {if _, ok := userMap[member]; ok {diff --git a/backend/api/v1/project_service_test.go b/backend/api/v1/project_service_test.goindex 6de480d7f8..d3d7bf6e6d 100644--- a/backend/api/v1/project_service_test.go+++ b/backend/api/v1/project_service_test.go@@ -108,7 +108,6 @@ func TestValidateBindings(t *testing.T) {},wantErr: true,},- // We have not merge the binding by the same role yet, so the roles in each binding must be unique.{bindings: []*v1pb.Binding{{@@ -129,7 +128,7 @@ func TestValidateBindings(t *testing.T) {Name: "roles/DEVELOPER",},},- wantErr: true,+ wantErr: false,},// Valid case.{