acl: make MatchType's constants public back

This commit is contained in:
Pavel Korotkov 2020-07-07 23:03:53 +03:00
parent f826517207
commit 2fba8cb7b3
3 changed files with 11 additions and 7 deletions

View file

@ -2,8 +2,12 @@ package acl
const (
_ MatchType = iota
stringEqual
stringNotEqual
// StringEqual is a MatchType of string equality.
StringEqual
// StringNotEqual is a MatchType of string inequality.
StringNotEqual
)
const (

View file

@ -83,9 +83,9 @@ func (s EACLFilterWrapper) MatchType() (res MatchType) {
if s.filter != nil {
switch s.filter.GetMatchType() {
case EACLRecord_FilterInfo_StringEqual:
res = stringEqual
res = StringEqual
case EACLRecord_FilterInfo_StringNotEqual:
res = stringNotEqual
res = StringNotEqual
}
}
@ -102,9 +102,9 @@ func (s EACLFilterWrapper) MatchType() (res MatchType) {
func (s EACLFilterWrapper) SetMatchType(v MatchType) {
if s.filter != nil {
switch v {
case stringEqual:
case StringEqual:
s.filter.SetMatchType(EACLRecord_FilterInfo_StringEqual)
case stringNotEqual:
case StringNotEqual:
s.filter.SetMatchType(EACLRecord_FilterInfo_StringNotEqual)
default:
s.filter.SetMatchType(EACLRecord_FilterInfo_MatchUnknown)

View file

@ -9,7 +9,7 @@ import (
func TestEACLFilterWrapper(t *testing.T) {
s := WrapFilterInfo(nil)
mt := stringEqual
mt := StringEqual
s.SetMatchType(mt)
require.Equal(t, mt, s.MatchType())