Skip to content

Commit

Permalink
Fix: Checking for correct token on worker management endpoints (#603)
Browse files Browse the repository at this point in the history
Resolve BE-1601
  • Loading branch information
nickpetrovic authored Oct 8, 2024
1 parent 874ea3f commit 525b5dd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/gateway/services/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 525b5dd

Please sign in to comment.