support cascading multiple acl modules
This commit is contained in:
parent
4f0bd74f87
commit
5c866d91b4
|
@ -24,6 +24,3 @@
|
|||
|
||||
{deny, all, subscribe, ["$SYS/#", {eq, "#"}]}.
|
||||
|
||||
{allow, all}.
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
-define(ACL_RULE_TAB, mqtt_acl_rule).
|
||||
|
||||
-record(state, {config, nomatch = allow}).
|
||||
-record(state, {config}).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% API
|
||||
|
@ -86,11 +86,11 @@ filter(_PubSub, {_AllowDeny, _Who, _, _Topics}) ->
|
|||
State :: #state{}).
|
||||
check_acl(_Who, #state{config = undefined}) ->
|
||||
allow;
|
||||
check_acl({Client, PubSub, Topic}, #state{nomatch = Default}) ->
|
||||
check_acl({Client, PubSub, Topic}, #state{}) ->
|
||||
case match(Client, Topic, lookup(PubSub)) of
|
||||
{matched, allow} -> allow;
|
||||
{matched, deny} -> deny;
|
||||
nomatch -> Default
|
||||
nomatch -> ignore
|
||||
end.
|
||||
|
||||
lookup(PubSub) ->
|
||||
|
|
Loading…
Reference in New Issue