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