chore: fix dialyzer error

This commit is contained in:
Rory Z 2021-08-19 11:43:00 +08:00 committed by Rory Z
parent bfb363bc61
commit 1886aa8bff
2 changed files with 5 additions and 10 deletions

View File

@ -1419,7 +1419,6 @@ check_pub_alias(_Packet, _Channel) -> ok.
check_pub_authz(#mqtt_packet{variable = #mqtt_packet_publish{topic_name = Topic}},
#channel{clientinfo = ClientInfo}) ->
case emqx_access_control:authorize(ClientInfo, publish, Topic) of
false -> ok;
allow -> ok;
deny -> {error, ?RC_NOT_AUTHORIZED}
end.
@ -1440,8 +1439,10 @@ check_pub_caps(#mqtt_packet{header = #mqtt_packet_header{qos = QoS,
check_sub_authzs(TopicFilters, Channel) ->
check_sub_authzs(TopicFilters, Channel, []).
check_sub_authzs([ TopicFilter = {Topic, _} | More] , Channel, Acc) ->
case check_sub_authz(Topic, Channel) of
check_sub_authzs([ TopicFilter = {Topic, _} | More],
Channel = #channel{clientinfo = ClientInfo},
Acc) ->
case emqx_access_control:authorize(ClientInfo, subscribe, Topic) of
allow ->
check_sub_authzs(More, Channel, [ {TopicFilter, 0} | Acc]);
deny ->
@ -1450,12 +1451,6 @@ check_sub_authzs([ TopicFilter = {Topic, _} | More] , Channel, Acc) ->
check_sub_authzs([], _Channel, Acc) ->
lists:reverse(Acc).
check_sub_authz(TopicFilter, #channel{clientinfo = ClientInfo}) ->
case emqx_access_control:authorize(ClientInfo, subscribe, TopicFilter) of
false -> allow;
Result -> Result
end.
%%--------------------------------------------------------------------
%% Check Sub Caps

View File

@ -649,7 +649,7 @@ handle_call(discard, Channel) ->
handle_call(list_authz_cache, Channel) ->
%% This won't work
{reply, emqx_authz_cache:list_authz_cache(default), Channel};
{reply, emqx_authz_cache:list_authz_cache(), Channel};
%% XXX: No Quota Now
% handle_call({quota, Policy}, Channel) ->