commit to merge
This commit is contained in:
parent
de87edac83
commit
e858c913ce
|
@ -28,8 +28,20 @@
|
||||||
|
|
||||||
-include("emqttd.hrl").
|
-include("emqttd.hrl").
|
||||||
|
|
||||||
-export([match/2]).
|
-export([match/3]).
|
||||||
|
|
||||||
|
match(_Who, _Topic, []) ->
|
||||||
|
nomatch;
|
||||||
|
match(_Who, _Topic, [{AllowDeny, all}|_Rules]) ->
|
||||||
|
AllowDeny;
|
||||||
|
match(User = #mqtt_user{clientid = ClientId}, Topic, [{AllowDeny, ClientId, Filter}|Rules]) ->
|
||||||
|
case emqttd_topic:match(Topic, Filter) of
|
||||||
|
true -> AllowDeny;
|
||||||
|
false -> match(User, Topic, Rules)
|
||||||
|
end;
|
||||||
|
match(User = #mqtt_user) ->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
match({User, Topic}, Rules) ->
|
|
||||||
ok.
|
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,8 @@ start_link() ->
|
||||||
check(PubSub, User, Topic) ->
|
check(PubSub, User, Topic) ->
|
||||||
case match(User, Topic, lookup(PubSub)) of
|
case match(User, Topic, lookup(PubSub)) of
|
||||||
nomatch -> allowed;
|
nomatch -> allowed;
|
||||||
allowed -> allowed;
|
allow -> allow;
|
||||||
refused -> refused
|
deny -> deny
|
||||||
end.
|
end.
|
||||||
|
|
||||||
lookup(PubSub) ->
|
lookup(PubSub) ->
|
||||||
|
|
Loading…
Reference in New Issue