From e34e7d386d86df5d9075503177cb8044ab43a452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 18 Nov 2019 17:48:58 +0100 Subject: [PATCH] Fix off-by-one bug in auth new --- cli/auth.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/auth.go b/cli/auth.go index 862738034..121f39463 100644 --- a/cli/auth.go +++ b/cli/auth.go @@ -41,14 +41,14 @@ var authCreateAdminToken = &cli.Command{ } perm := cctx.String("perm") - idx := -1 + idx := 0 for i, p := range api.AllPermissions { if perm == p { - idx = i + idx = i + 1 } } - if idx == -1 { + if idx == 0 { return fmt.Errorf("--perm flag has to be one of: %s", api.AllPermissions) }