From 3e68cea0d783ef524b5eb3a95fdaf810ec640454 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 4 Nov 2024 00:53:36 +0800 Subject: [PATCH] :bug: Fix string perm number value node --- pkg/nex/sec/perms.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/nex/sec/perms.go b/pkg/nex/sec/perms.go index 0cbdb7f..14ec172 100644 --- a/pkg/nex/sec/perms.go +++ b/pkg/nex/sec/perms.go @@ -3,6 +3,7 @@ package sec import ( "fmt" "reflect" + "strconv" ) func (v UserInfo) HasPermNode(requiredKey string, requiredValue any) bool { @@ -41,6 +42,11 @@ func comparePermNode(held any, required any) bool { heldValue := reflect.ValueOf(held) requiredValue := reflect.ValueOf(required) + if isNumeric(requiredValue) && heldValue.Kind() == reflect.String { + numericValue, _ := strconv.ParseFloat(heldValue.String(), 64) + return toFloat64(requiredValue) >= numericValue + } + switch heldValue.Kind() { case reflect.String: if heldValue.String() == requiredValue.String() {