IS_PUBSUB

This commit is contained in:
Feng 2015-10-13 20:56:10 +08:00
parent 192dc85304
commit a055a0a0c8
1 changed files with 3 additions and 3 deletions

View File

@ -24,6 +24,7 @@
%%% %%%
%%% @end %%% @end
%%%----------------------------------------------------------------------------- %%%-----------------------------------------------------------------------------
-module(emqttd_access_control). -module(emqttd_access_control).
-author("Feng Lee <feng@emqtt.io>"). -author("Feng Lee <feng@emqtt.io>").
@ -61,8 +62,7 @@
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-spec start_link() -> {ok, pid()} | ignore | {error, any()}. -spec start_link() -> {ok, pid()} | ignore | {error, any()}.
start_link() -> start_link() ->
{ok, AcOpts} = application:get_env(emqttd, access), start_link(emqttd:env(access)).
start_link(AcOpts).
-spec start_link(AcOpts :: list()) -> {ok, pid()} | ignore | {error, any()}. -spec start_link(AcOpts :: list()) -> {ok, pid()} | ignore | {error, any()}.
start_link(AcOpts) -> start_link(AcOpts) ->
@ -92,7 +92,7 @@ auth(Client, Password, [{Mod, State} | Mods]) ->
Client :: mqtt_client(), Client :: mqtt_client(),
PubSub :: pubsub(), PubSub :: pubsub(),
Topic :: binary(). Topic :: binary().
check_acl(Client, PubSub, Topic) when PubSub =:= publish orelse PubSub =:= subscribe -> check_acl(Client, PubSub, Topic) when ?IS_PUBSUB(PubSub) ->
case lookup_mods(acl) of case lookup_mods(acl) of
[] -> allow; [] -> allow;
AclMods -> check_acl(Client, PubSub, Topic, AclMods) AclMods -> check_acl(Client, PubSub, Topic, AclMods)