2.0 - support 'cache_acl' option
This commit is contained in:
parent
0dbbe7d0df
commit
9555b0bf05
|
@ -397,13 +397,16 @@ validate_qos(_) ->
|
||||||
|
|
||||||
%% PUBLISH ACL is cached in process dictionary.
|
%% PUBLISH ACL is cached in process dictionary.
|
||||||
check_acl(publish, Topic, Client) ->
|
check_acl(publish, Topic, Client) ->
|
||||||
case get({acl, publish, Topic}) of
|
IfCache = emqttd:conf(cache_acl, true),
|
||||||
undefined ->
|
case {IfCache, get({acl, publish, Topic})} of
|
||||||
|
{true, undefined} ->
|
||||||
AllowDeny = emqttd_access_control:check_acl(Client, publish, Topic),
|
AllowDeny = emqttd_access_control:check_acl(Client, publish, Topic),
|
||||||
put({acl, publish, Topic}, AllowDeny),
|
put({acl, publish, Topic}, AllowDeny),
|
||||||
AllowDeny;
|
AllowDeny;
|
||||||
AllowDeny ->
|
{true, AllowDeny} ->
|
||||||
AllowDeny
|
AllowDeny;
|
||||||
|
{false, _} ->
|
||||||
|
emqttd_access_control:check_acl(Client, publish, Topic)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
check_acl(subscribe, Topic, Client) ->
|
check_acl(subscribe, Topic, Client) ->
|
||||||
|
|
Loading…
Reference in New Issue