From e858c913ce3d4bb9ea212603530b04f4bf5df09f Mon Sep 17 00:00:00 2001 From: Feng Lee Date: Thu, 26 Mar 2015 22:21:06 +0800 Subject: [PATCH] commit to merge --- apps/emqttd/src/emqttd_access.erl | 18 +++++++++++++++--- apps/emqttd/src/emqttd_acl.erl | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/emqttd/src/emqttd_access.erl b/apps/emqttd/src/emqttd_access.erl index 7be0d044c..7e496698a 100644 --- a/apps/emqttd/src/emqttd_access.erl +++ b/apps/emqttd/src/emqttd_access.erl @@ -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. diff --git a/apps/emqttd/src/emqttd_acl.erl b/apps/emqttd/src/emqttd_acl.erl index b05688bd0..92fedc9fd 100644 --- a/apps/emqttd/src/emqttd_acl.erl +++ b/apps/emqttd/src/emqttd_acl.erl @@ -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) ->