Fix the check_subacl bug when enable_acl is set to false

This commit is contained in:
GilbertWong 2019-07-10 11:13:17 +08:00 committed by turtleDeng
parent 41dcb4acf2
commit c13e194838
1 changed files with 3 additions and 3 deletions

View File

@ -891,11 +891,11 @@ check_sub_acl(TopicFilters, #pstate{credentials = #{is_superuser := IsSuper}})
check_sub_acl(TopicFilters, #pstate{zone = Zone, credentials = Credentials}) ->
EnableAcl = emqx_zone:get_env(Zone, enable_acl, false),
lists:foldr(
fun({Topic, SubOpts}, {Ok, Acc}) when EnableAcl ->
AllowTerm = {Ok, [{Topic, SubOpts}|Acc]},
fun({Topic, SubOpts}, {ok, Acc}) when EnableAcl ->
AllowTerm = {ok, [{Topic, SubOpts}|Acc]},
DenyTerm = {error, [{Topic, SubOpts#{rc := ?RC_NOT_AUTHORIZED}}|Acc]},
do_acl_check(subscribe, Credentials, Topic, AllowTerm, DenyTerm);
(TopicFilter, Acc) ->
(TopicFilter, {ok, Acc}) ->
{ok, [TopicFilter | Acc]}
end, {ok, []}, TopicFilters).