feat(authz): fix typos and style for Retain & QoS authz feature

Co-authored-by: Thales Macedo Garitezi <thalesmg@gmail.com>
This commit is contained in:
Ilya Averyanov 2023-07-07 16:20:55 +03:00
parent 6db02d6b49
commit 77895f2555
5 changed files with 19 additions and 19 deletions

View File

@ -130,14 +130,14 @@ $(foreach app,$(APPS),$(eval $(call gen-app-prop-target,$(app))))
ct-suite: $(REBAR) merge-config clean-test-cluster-config ct-suite: $(REBAR) merge-config clean-test-cluster-config
ifneq ($(TESTCASE),) ifneq ($(TESTCASE),)
ifneq ($(GROUP),) ifneq ($(GROUP),)
$(REBAR) ct -c -v --readable=$(CT_READABLE) --name $(CT_NODE_NAME) --suite $(SUITE) --case $(TESTCASE) --group $(GROUP) $(REBAR) ct -v --readable=$(CT_READABLE) --name $(CT_NODE_NAME) --suite $(SUITE) --case $(TESTCASE) --group $(GROUP)
else else
$(REBAR) ct -c -v --readable=$(CT_READABLE) --name $(CT_NODE_NAME) --suite $(SUITE) --case $(TESTCASE) $(REBAR) ct -v --readable=$(CT_READABLE) --name $(CT_NODE_NAME) --suite $(SUITE) --case $(TESTCASE)
endif endif
else ifneq ($(GROUP),) else ifneq ($(GROUP),)
$(REBAR) ct -c -v --readable=$(CT_READABLE) --name $(CT_NODE_NAME) --suite $(SUITE) --group $(GROUP) $(REBAR) ct -v --readable=$(CT_READABLE) --name $(CT_NODE_NAME) --suite $(SUITE) --group $(GROUP)
else else
$(REBAR) ct -c -v --readable=$(CT_READABLE) --name $(CT_NODE_NAME) --suite $(SUITE) $(REBAR) ct -v --readable=$(CT_READABLE) --name $(CT_NODE_NAME) --suite $(SUITE)
endif endif
.PHONY: cover .PHONY: cover

View File

@ -1840,7 +1840,7 @@ check_pub_alias(_Packet, _Channel) ->
ok. ok.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Athorization action %% Authorization action
authz_action(#mqtt_packet{ authz_action(#mqtt_packet{
header = #mqtt_packet_header{qos = QoS, retain = Retain}, variable = #mqtt_packet_publish{} header = #mqtt_packet_header{qos = QoS, retain = Retain}, variable = #mqtt_packet_publish{}

View File

@ -49,12 +49,12 @@
username => user1, username => user1,
rules => [ rules => [
#{ #{
topic => <<"test/toopic/1">>, topic => <<"test/topic/1">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">> action => <<"publish">>
}, },
#{ #{
topic => <<"test/toopic/2">>, topic => <<"test/topic/2">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"subscribe">> action => <<"subscribe">>
}, },
@ -64,14 +64,14 @@
action => <<"all">> action => <<"all">>
}, },
#{ #{
topic => <<"test/toopic/3">>, topic => <<"test/topic/3">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">>, action => <<"publish">>,
qos => [<<"1">>], qos => [<<"1">>],
retain => <<"true">> retain => <<"true">>
}, },
#{ #{
topic => <<"test/toopic/4">>, topic => <<"test/topic/4">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">>, action => <<"publish">>,
qos => [<<"0">>, <<"1">>, <<"2">>], qos => [<<"0">>, <<"1">>, <<"2">>],
@ -83,12 +83,12 @@
clientid => client1, clientid => client1,
rules => [ rules => [
#{ #{
topic => <<"test/toopic/1">>, topic => <<"test/topic/1">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">> action => <<"publish">>
}, },
#{ #{
topic => <<"test/toopic/2">>, topic => <<"test/topic/2">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"subscribe">> action => <<"subscribe">>
}, },
@ -98,14 +98,14 @@
action => <<"all">> action => <<"all">>
}, },
#{ #{
topic => <<"test/toopic/3">>, topic => <<"test/topic/3">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">>, action => <<"publish">>,
qos => [<<"1">>], qos => [<<"1">>],
retain => <<"true">> retain => <<"true">>
}, },
#{ #{
topic => <<"test/toopic/4">>, topic => <<"test/topic/4">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">>, action => <<"publish">>,
qos => [<<"0">>, <<"1">>, <<"2">>], qos => [<<"0">>, <<"1">>, <<"2">>],
@ -116,12 +116,12 @@
-define(ALL_RULES_EXAMPLE, #{ -define(ALL_RULES_EXAMPLE, #{
rules => [ rules => [
#{ #{
topic => <<"test/toopic/1">>, topic => <<"test/topic/1">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">> action => <<"publish">>
}, },
#{ #{
topic => <<"test/toopic/2">>, topic => <<"test/topic/2">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"subscribe">> action => <<"subscribe">>
}, },
@ -131,14 +131,14 @@
action => <<"all">> action => <<"all">>
}, },
#{ #{
topic => <<"test/toopic/3">>, topic => <<"test/topic/3">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">>, action => <<"publish">>,
qos => [<<"1">>], qos => [<<"1">>],
retain => <<"true">> retain => <<"true">>
}, },
#{ #{
topic => <<"test/toopic/4">>, topic => <<"test/topic/4">>,
permission => <<"allow">>, permission => <<"allow">>,
action => <<"publish">>, action => <<"publish">>,
qos => [<<"0">>, <<"1">>, <<"2">>], qos => [<<"0">>, <<"1">>, <<"2">>],

View File

@ -525,7 +525,7 @@ read_acl_file(#{<<"path">> := Path} = Source) ->
maps:remove(<<"path">>, Source#{<<"rules">> => Rules}). maps:remove(<<"path">>, Source#{<<"rules">> => Rules}).
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% Extednded Features %% Extended Features
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-define(DEFAULT_RICH_ACTIONS, true). -define(DEFAULT_RICH_ACTIONS, true).

View File

@ -60,7 +60,7 @@
-type rule() :: {permission(), who_condition(), action_condition(), topic_condition()}. -type rule() :: {permission(), who_condition(), action_condition(), topic_condition()}.
-type qos() :: 0..2. -type qos() :: emqx_types:qos().
-type retain() :: boolean(). -type retain() :: boolean().
-type action() :: -type action() ::
#{action_type := subscribe, qos := qos()} #{action_type := subscribe, qos := qos()}