Skip to content

Commit

Permalink
fix: permission not found
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Jun 5, 2023
1 parent 6ddc980 commit efcd6ad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions cli/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ var authApiInfoToken = &cli.Command{
return errors.New("--perm flag not set")
}

// todo core.AdaptOldStrategy 获取的顺序是 []Permission{PermAdmin, PermSign, PermWrite, PermRead}, 在 venus-auth 中修改?
allPermissions := []core.Permission{core.PermRead, core.PermWrite, core.PermSign, core.PermAdmin}
allPermissions := core.AdaptOldStrategy(core.PermAdmin)
perm := cctx.String("perm")
idx := 0
for i, p := range allPermissions {
Expand Down
5 changes: 3 additions & 2 deletions cmd/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package cmd
import (
"context"
"fmt"
"github.com/filecoin-project/venus-auth/core"
"net/http"
_ "net/http/pprof"
"os"
"os/signal"
"strings"
"syscall"

"github.com/filecoin-project/venus-auth/core"

"github.com/etherlabsio/healthcheck/v2"
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/go-jsonrpc/auth"
Expand Down Expand Up @@ -121,7 +122,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}

// todo venus-auth 中定义的 permKey(=2) 和 go-jsonrpc 库中 permCtxKey(0) 不一致, 且 CtxWithPerm 函数参数和 Verify 的返回值不一致, 应考虑一致性, 还有如果把 permCtxKey 等统一用 venus-auth中的话, 是不是 go-jsonrpc 可以用 filecoin 官方的,而不再自己维护?
ctx = core.CtxWithPerm(ctx, allow[0])
ctx = core.CtxWithPerms(ctx, allow)
//ctx = auth.WithPerm(ctx, allow)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/filecoin-project/go-state-types v0.11.1
github.com/filecoin-project/specs-actors/v2 v2.3.6
github.com/filecoin-project/venus v1.11.2-0.20230531024835-12121f11dab7
github.com/filecoin-project/venus-auth v1.11.1-0.20230511013901-7829b3effbcd
github.com/filecoin-project/venus-auth v1.11.1-0.20230605053244-c7cb861d94cd
github.com/fsnotify/fsnotify v1.5.4
github.com/gbrlsnchs/jwt/v3 v3.0.1
github.com/google/uuid v1.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ github.com/filecoin-project/venus v1.2.4/go.mod h1:hJULXHGAnWuq5S5KRtPkwbT8DqgM9
github.com/filecoin-project/venus v1.11.2-0.20230531024835-12121f11dab7 h1:Oo5tVsHt8L0iLKHCfoaAPZVAVKIhjnAMWfgpVfexzEk=
github.com/filecoin-project/venus v1.11.2-0.20230531024835-12121f11dab7/go.mod h1:9QctTOegFH+hZ5icsuR2BRRnZMhyLDQa5uJAbOog76M=
github.com/filecoin-project/venus-auth v1.3.2/go.mod h1:m5Jog2GYxztwP7w3m/iJdv/V1/bTcAVU9rm/CbhxRQU=
github.com/filecoin-project/venus-auth v1.11.1-0.20230511013901-7829b3effbcd h1:l02UJuEbSUIBi3NC/+17K2gBbAzsUNQg42rNCXskOBc=
github.com/filecoin-project/venus-auth v1.11.1-0.20230511013901-7829b3effbcd/go.mod h1:PoTmfEn5lljjAQThBzX0+friJYGgi7Z3VLLujkOkCT4=
github.com/filecoin-project/venus-auth v1.11.1-0.20230605053244-c7cb861d94cd h1:CrQ804I3PH3lRihJS1a8wyLTII+jhRMMuJX3oJ1ltbI=
github.com/filecoin-project/venus-auth v1.11.1-0.20230605053244-c7cb861d94cd/go.mod h1:PoTmfEn5lljjAQThBzX0+friJYGgi7Z3VLLujkOkCT4=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
github.com/flynn/noise v1.0.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag=
Expand Down

0 comments on commit efcd6ad

Please sign in to comment.