harness-drone/plugin/admission/combine.go

30 lines
651 B
Go
Raw Normal View History

2019-02-19 23:56:41 +00:00
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
package admission
import (
"context"
"github.com/drone/drone/core"
)
// Combine combines admission services.
func Combine(service ...core.AdmissionService) core.AdmissionService {
return &combined{services: service}
}
type combined struct {
services []core.AdmissionService
}
func (s *combined) Admit(ctx context.Context, user *core.User) error {
for _, service := range s.services {
if err := service.Admit(ctx, user); err != nil {
return err
}
}
return nil
}