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}}, check_pub_authz(#mqtt_packet{variable = #mqtt_packet_publish{topic_name = Topic}},
#channel{clientinfo = ClientInfo}) -> #channel{clientinfo = ClientInfo}) ->
case emqx_access_control:authorize(ClientInfo, publish, Topic) of case emqx_access_control:authorize(ClientInfo, publish, Topic) of
false -> ok;
allow -> ok; allow -> ok;
deny -> {error, ?RC_NOT_AUTHORIZED} deny -> {error, ?RC_NOT_AUTHORIZED}
end. 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(TopicFilters, Channel, []). check_sub_authzs(TopicFilters, Channel, []).
check_sub_authzs([ TopicFilter = {Topic, _} | More] , Channel, Acc) -> check_sub_authzs([ TopicFilter = {Topic, _} | More],
case check_sub_authz(Topic, Channel) of Channel = #channel{clientinfo = ClientInfo},
Acc) ->
case emqx_access_control:authorize(ClientInfo, subscribe, Topic) of
allow -> allow ->
check_sub_authzs(More, Channel, [ {TopicFilter, 0} | Acc]); check_sub_authzs(More, Channel, [ {TopicFilter, 0} | Acc]);
deny -> deny ->
@ -1450,12 +1451,6 @@ check_sub_authzs([ TopicFilter = {Topic, _} | More] , Channel, Acc) ->
check_sub_authzs([], _Channel, Acc) -> check_sub_authzs([], _Channel, Acc) ->
lists:reverse(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 %% Check Sub Caps

View File

@ -649,7 +649,7 @@ handle_call(discard, Channel) ->
handle_call(list_authz_cache, Channel) -> handle_call(list_authz_cache, Channel) ->
%% This won't work %% 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 %% XXX: No Quota Now
% handle_call({quota, Policy}, Channel) -> % handle_call({quota, Policy}, Channel) ->