valueInList 检查值是否在列表中
(value string, list any)
| 719 | |
| 720 | // valueInList 检查值是否在列表中 |
| 721 | func (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 按优先级排序策略 |
| 738 | func (ac *AccessController) sortPoliciesByPriority(policies []*AccessPolicy) []*AccessPolicy { |