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

Method valueInList

pkg/security/access_control.go:721–735  ·  view source on GitHub ↗

valueInList 检查值是否在列表中

(value string, list any)

Source from the content-addressed store, hash-verified

719
720// valueInList 检查值是否在列表中
721func (ac *AccessController) valueInList(value string, list any) bool {
722 switch list := list.(type) {
723 case []string:
724 if slices.Contains(list, value) {
725 return true
726 }
727 case []any:
728 for _, item := range list {
729 if fmt.Sprintf("%v", item) == value {
730 return true
731 }
732 }
733 }
734 return false
735}
736
737// sortPoliciesByPriority 按优先级排序策略
738func (ac *AccessController) sortPoliciesByPriority(policies []*AccessPolicy) []*AccessPolicy {

Callers 1

compareValuesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected