Describe the bug
I found that integers passed into 'Enforce' are treated as strings ,which caused '<' and '>' operators in model cannot work as users' expectation
To Reproduce
Steps to reproduce the behavior:
- Use this model
[request_definition]
r = namespace, cpu, memory
[policy_definition]
p = namespace, cpu, memory, eft
[policy_effect]
e=!some(where (p.eft == deny))
[matchers]
m= r.namespace == p.namespace && ( r.cpu > p.cpu || r.memory > p.memory )
- Use the following policy
p,default,104857600,104857600,deny
- Run the following golang code
package main
import (
"fmt"
casbin "github.com/casbin/casbin/v2"
)
func main() {
enforcer, _ := casbin.NewEnforcer("container_resource_limit.conf","container_resource_limit.csv")
res,err:=enforcer.Enforce("default",10000,10000)
fmt.Println(err.Error())
fmt.Println(res)
}
- See the following error in output
PS D:\workspace\vscode\golang> go run . Value '10000' cannot be used with the comparator '>', it is not a number false
Expected behavior
The operator '>' should have worked.
Desktop (please complete the following information):
- OS: Both Windows 10 and Windows WSL2
- Golang: go 1.16
- Casbin Version v2.36.1
Describe the bug
I found that integers passed into 'Enforce' are treated as strings ,which caused '<' and '>' operators in model cannot work as users' expectation
To Reproduce
Steps to reproduce the behavior:
p,default,104857600,104857600,denyPS D:\workspace\vscode\golang> go run . Value '10000' cannot be used with the comparator '>', it is not a number falseExpected behavior
The operator '>' should have worked.
Desktop (please complete the following information):