Add warning log for unauthored subscribe
Prior to this change, there is no log for unauthored log, it is difficult to find the problem when subscription error occured.
This commit is contained in:
parent
0adee194aa
commit
30d986c318
|
@ -747,7 +747,11 @@ check_sub_acl(TopicFilters, PState) ->
|
|||
fun({Topic, SubOpts}, {Ok, Acc}) ->
|
||||
case emqx_access_control:check_acl(Credentials, subscribe, Topic) of
|
||||
allow -> {Ok, [{Topic, SubOpts}|Acc]};
|
||||
deny -> {error, [{Topic, SubOpts#{rc := ?RC_NOT_AUTHORIZED}}|Acc]}
|
||||
deny ->
|
||||
emqx_logger:warning([{client, PState#pstate.client_id}],
|
||||
"ACL(~s) Cannot SUBSCRIBE ~p for ACL Deny",
|
||||
[PState#pstate.client_id, Topic]),
|
||||
{error, [{Topic, SubOpts#{rc := ?RC_NOT_AUTHORIZED}}|Acc]}
|
||||
end
|
||||
end, {ok, []}, TopicFilters).
|
||||
|
||||
|
|
Loading…
Reference in New Issue