github.com/chenbh/concourse/v6@v6.4.2/atc/wrappa/accessor_wrappa.go (about) 1 package wrappa 2 3 import ( 4 "code.cloudfoundry.org/lager" 5 "github.com/chenbh/concourse/v6/atc/api/accessor" 6 "github.com/chenbh/concourse/v6/atc/auditor" 7 "github.com/tedsuo/rata" 8 ) 9 10 func NewAccessorWrappa( 11 logger lager.Logger, 12 accessFactory accessor.AccessFactory, 13 auditor auditor.Auditor, 14 customRoles map[string]string, 15 ) *AccessorWrappa { 16 return &AccessorWrappa{ 17 logger: logger, 18 accessFactory: accessFactory, 19 auditor: auditor, 20 customRoles: customRoles, 21 } 22 } 23 24 type AccessorWrappa struct { 25 logger lager.Logger 26 accessFactory accessor.AccessFactory 27 auditor auditor.Auditor 28 customRoles map[string]string 29 } 30 31 func (w *AccessorWrappa) Wrap(handlers rata.Handlers) rata.Handlers { 32 wrapped := rata.Handlers{} 33 34 for name, handler := range handlers { 35 wrapped[name] = accessor.NewHandler( 36 w.logger, 37 name, 38 handler, 39 w.accessFactory, 40 w.auditor, 41 w.customRoles, 42 ) 43 } 44 45 return wrapped 46 }