harness-drone/plugin/admission/combine.go
2019-02-19 15:56:41 -08:00

29 lines
651 B
Go

// 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
}