MCPcopy Create free account
hub / github.com/astercloud/aster / compareValues

Method compareValues

pkg/security/access_control.go:704–718  ·  view source on GitHub ↗

compareValues 比较值

(actual any, operator string, expected any)

Source from the content-addressed store, hash-verified

702
703// compareValues 比较值
704func (ac *AccessController) compareValues(actual any, operator string, expected any) bool {
705 actualStr := fmt.Sprintf("%v", actual)
706 expectedStr := fmt.Sprintf("%v", expected)
707
708 switch operator {
709 case "eq":
710 return actualStr == expectedStr
711 case "ne":
712 return actualStr != expectedStr
713 case "in":
714 return ac.valueInList(actualStr, expected)
715 default:
716 return false
717 }
718}
719
720// valueInList 检查值是否在列表中
721func (ac *AccessController) valueInList(value string, list any) bool {

Callers 2

evaluateConditionMethod · 0.95

Calls 1

valueInListMethod · 0.95

Tested by

no test coverage detected