Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acl: memdb filter of tokens-by-policy was inverted #5575

Merged
merged 1 commit into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions agent/consul/state/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,16 +523,16 @@ func (s *Store) ACLTokenList(ws memdb.WatchSet, local, global bool, policy strin
iter = memdb.NewFilterIterator(iter, func(raw interface{}) bool {
token, ok := raw.(*structs.ACLToken)
if !ok {
return false
return true
}

if global && !token.Local {
return true
return false
} else if local && token.Local {
return true
return false
}

return false
return true
})
}
} else if global == local {
Expand Down
2 changes: 1 addition & 1 deletion agent/consul/state/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@ func TestStateStore_ACLToken_List(t *testing.T) {
policy: "a0625e95-9b3e-42de-a8d6-ceef5b6f3286",
accessors: []string{
"47eea4da-bda1-48a6-901c-3e36d2d9262f",
"4915fc9d-3726-4171-b588-6c271f45eecd",
},
},
{
Expand All @@ -788,6 +787,7 @@ func TestStateStore_ACLToken_List(t *testing.T) {
}

for _, tc := range cases {
tc := tc // capture range variable
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
_, tokens, err := s.ACLTokenList(nil, tc.local, tc.global, tc.policy)
Expand Down