Merge pull request #635 from filecoin-project/fix/authnew

Fix off-by-one bug in auth new
This commit is contained in:
Łukasz Magiera 2019-11-19 13:58:45 +01:00 committed by GitHub
commit 293961c919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}