diff --git a/cmd/santa-sleigh/contract.go b/cmd/santa-sleigh/contract.go index 88e8e78..15b342a 100644 --- a/cmd/santa-sleigh/contract.go +++ b/cmd/santa-sleigh/contract.go @@ -3,6 +3,8 @@ package main import ( + "github.com/pkg/errors" + "github.com/ice-blockchain/santa/badges" friendsinvited "github.com/ice-blockchain/santa/friends-invited" levelsandroles "github.com/ice-blockchain/santa/levels-and-roles" @@ -35,6 +37,13 @@ const ( taskNotCompletedCode = "TASK_NOT_COMPLETED" ) +// . +var ( + //nolint:gochecknoglobals // Because its loaded once, at runtime. + cfg config + errForbidden = errors.New("disabled") +) + type ( // | service implements server.State and is responsible for managing the state and lifecycle of the package. service struct { diff --git a/cmd/santa-sleigh/santa_sleigh.go b/cmd/santa-sleigh/santa_sleigh.go index 7c5e74f..aa924ea 100644 --- a/cmd/santa-sleigh/santa_sleigh.go +++ b/cmd/santa-sleigh/santa_sleigh.go @@ -29,7 +29,6 @@ func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - var cfg config appcfg.MustLoadFromKey(applicationYamlKey, &cfg) api.SwaggerInfo.Host = cfg.Host api.SwaggerInfo.Version = cfg.Version diff --git a/cmd/santa-sleigh/tasks.go b/cmd/santa-sleigh/tasks.go index c8088de..8697554 100644 --- a/cmd/santa-sleigh/tasks.go +++ b/cmd/santa-sleigh/tasks.go @@ -41,6 +41,9 @@ func (s *service) PseudoCompleteTask( //nolint:gocritic // False negative. ctx context.Context, req *server.Request[CompleteTaskRequestBody, any], ) (*server.Response[any], *server.Response[server.ErrorResponse]) { + if cfg.Tenant == "doctorx" { + return nil, server.Forbidden(errForbidden) + } task := &tasks.Task{ Data: req.Data.Data, Type: req.Data.TaskType, diff --git a/go.mod b/go.mod index 25d4140..ac5458e 100644 --- a/go.mod +++ b/go.mod @@ -168,9 +168,9 @@ require ( golang.org/x/tools v0.27.0 // indirect google.golang.org/api v0.209.0 // indirect google.golang.org/appengine/v2 v2.0.6 // indirect - google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 // indirect + google.golang.org/genproto v0.0.0-20241202173237-19429a94021a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect google.golang.org/grpc v1.68.0 // indirect google.golang.org/grpc/stats/opentelemetry v0.0.0-20241028142157-ada6787961b3 // indirect google.golang.org/protobuf v1.35.2 // indirect diff --git a/go.sum b/go.sum index 455646b..1013d55 100644 --- a/go.sum +++ b/go.sum @@ -500,12 +500,12 @@ google.golang.org/appengine/v2 v2.0.6/go.mod h1:WoEXGoXNfa0mLvaH5sV3ZSGXwVmy8yf7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk= -google.golang.org/genproto v0.0.0-20241118233622-e639e219e697/go.mod h1:JJrvXBWRZaFMxBufik1a4RpFw4HhgVtBBWQeQgUj2cc= -google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 h1:pgr/4QbFyktUv9CtQ/Fq4gzEE6/Xs7iCXbktaGzLHbQ= -google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697/go.mod h1:+D9ySVjN8nY8YCVjc5O7PZDIdZporIDY3KaGfJunh88= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697 h1:LWZqQOEjDyONlF1H6afSWpAL/znlREo2tHfLoe+8LMA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/genproto v0.0.0-20241202173237-19429a94021a h1:4voejwOVTsjw6IMfnGt8IzTQBIw45hP8S0e77UMounA= +google.golang.org/genproto v0.0.0-20241202173237-19429a94021a/go.mod h1:dW27OyXi0Ph+N43jeCWMFC86aTT5VgdeQtOSf0Hehdw= +google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a h1:OAiGFfOiA0v9MRYsSidp3ubZaBnteRUyn3xB2ZQ5G/E= +google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a/go.mod h1:jehYqy3+AhJU9ve55aNOaSml7wUXjF9x6z2LcCfpAhY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a h1:hgh8P4EuoxpsuKMXX/To36nOFD7vixReXgn8lPGnt+o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=