Rename 'Credentials' to 'Client'

This commit is contained in:
Feng Lee 2019-07-30 19:10:38 +08:00
parent c55ada3526
commit 51fb4e33d6
1 changed files with 6 additions and 6 deletions

View File

@ -64,8 +64,8 @@ all_rules() ->
-spec(check_acl(emqx_types:credentials(), emqx_types:pubsub(), emqx_topic:topic(), -spec(check_acl(emqx_types:credentials(), emqx_types:pubsub(), emqx_topic:topic(),
emqx_access_rule:acl_result(), acl_rules()) emqx_access_rule:acl_result(), acl_rules())
-> {ok, allow} | {ok, deny} | ok). -> {ok, allow} | {ok, deny} | ok).
check_acl(Credentials, PubSub, Topic, _AclResult, Rules) -> check_acl(Client, PubSub, Topic, _AclResult, Rules) ->
case match(Credentials, Topic, lookup(PubSub, Rules)) of case match(Client, Topic, lookup(PubSub, Rules)) of
{matched, allow} -> {ok, allow}; {matched, allow} -> {ok, allow};
{matched, deny} -> {ok, deny}; {matched, deny} -> {ok, deny};
nomatch -> ok nomatch -> ok
@ -85,12 +85,12 @@ acl_file() ->
lookup(PubSub, Rules) -> lookup(PubSub, Rules) ->
maps:get(PubSub, Rules, []). maps:get(PubSub, Rules, []).
match(_Credentials, _Topic, []) -> match(_Client, _Topic, []) ->
nomatch; nomatch;
match(Credentials, Topic, [Rule|Rules]) -> match(Client, Topic, [Rule|Rules]) ->
case emqx_access_rule:match(Credentials, Topic, Rule) of case emqx_access_rule:match(Client, Topic, Rule) of
nomatch -> nomatch ->
match(Credentials, Topic, Rules); match(Client, Topic, Rules);
{matched, AllowDeny} -> {matched, AllowDeny} ->
{matched, AllowDeny} {matched, AllowDeny}
end. end.