commit to merge

This commit is contained in:
Feng Lee 2015-03-26 22:21:06 +08:00
parent de87edac83
commit e858c913ce
2 changed files with 17 additions and 5 deletions

View File

@ -28,8 +28,20 @@
-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.

View File

@ -86,8 +86,8 @@ start_link() ->
check(PubSub, User, Topic) ->
case match(User, Topic, lookup(PubSub)) of
nomatch -> allowed;
allowed -> allowed;
refused -> refused
allow -> allow;
deny -> deny
end.
lookup(PubSub) ->