From 525b5ddec460b385997129f053e110ff921d0251 Mon Sep 17 00:00:00 2001 From: nickpetrovic <4001122+nickpetrovic@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:40:49 -0400 Subject: [PATCH] Fix: Checking for correct token on worker management endpoints (#603) Resolve BE-1601 --- pkg/gateway/services/worker.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/gateway/services/worker.go b/pkg/gateway/services/worker.go index 83afe468c..06759897b 100644 --- a/pkg/gateway/services/worker.go +++ b/pkg/gateway/services/worker.go @@ -195,5 +195,8 @@ func (gws *GatewayService) DrainWorker(ctx context.Context, in *pb.DrainWorkerRe func isClusterAdmin(ctx context.Context) (bool, error) { authInfo, _ := auth.AuthInfoFromContext(ctx) - return authInfo.Token.TokenType == types.TokenTypeClusterAdmin, errors.New("This action is not permitted") + if authInfo.Token.TokenType == types.TokenTypeClusterAdmin { + return true, nil + } + return false, errors.New("This action is not permitted") }