chore(authz): rename authorization_rules.conf to acl.conf

This commit is contained in:
zhanghongtong 2021-09-06 09:39:27 +08:00 committed by Rory Z
parent bd7a8179b4
commit 1699a8dc63
6 changed files with 6 additions and 6 deletions

View File

@ -57,7 +57,7 @@ authorization {
# }, # },
{ {
type: file type: file
path: "{{ platform_etc_dir }}/authorization_rules.conf" path: "{{ platform_etc_dir }}/acl.conf"
} }
] ]
} }

View File

@ -330,7 +330,7 @@ sources(get, _) ->
end, [], emqx_authz:lookup()), end, [], emqx_authz:lookup()),
{200, #{sources => Sources}}; {200, #{sources => Sources}};
sources(post, #{body := #{<<"type">> := <<"file">>, <<"rules">> := Rules, <<"enable">> := Enable}}) when is_list(Rules) -> sources(post, #{body := #{<<"type">> := <<"file">>, <<"rules">> := Rules, <<"enable">> := Enable}}) when is_list(Rules) ->
{ok, Filename} = write_file(filename:join([emqx:get_config([node, data_dir]), "authorization_rules.conf"]), {ok, Filename} = write_file(filename:join([emqx:get_config([node, data_dir]), "acl.conf"]),
erlang:list_to_bitstring([<<Rule/binary, "\n">> || Rule <- Rules]) erlang:list_to_bitstring([<<Rule/binary, "\n">> || Rule <- Rules])
), ),
case emqx_authz:update(head, [#{type => file, enable => Enable, path => Filename}]) of case emqx_authz:update(head, [#{type => file, enable => Enable, path => Filename}]) of
@ -350,7 +350,7 @@ sources(put, #{body := Body}) when is_list(Body) ->
NBody = [ begin NBody = [ begin
case Source of case Source of
#{<<"type">> := <<"file">>, <<"rules">> := Rules, <<"enable">> := Enable} -> #{<<"type">> := <<"file">>, <<"rules">> := Rules, <<"enable">> := Enable} ->
{ok, Filename} = write_file(filename:join([emqx:get_config([node, data_dir]), "authorization_rules.conf"]), {ok, Filename} = write_file(filename:join([emqx:get_config([node, data_dir]), "acl.conf"]),
erlang:list_to_bitstring([<<Rule/binary, "\n">> || Rule <- Rules]) erlang:list_to_bitstring([<<Rule/binary, "\n">> || Rule <- Rules])
), ),
#{type => file, enable => Enable, path => Filename}; #{type => file, enable => Enable, path => Filename};

View File

@ -111,7 +111,7 @@ init_per_testcase(_, Config) ->
}). }).
-define(SOURCE6, #{<<"type">> => <<"file">>, -define(SOURCE6, #{<<"type">> => <<"file">>,
<<"enable">> => true, <<"enable">> => true,
<<"path">> => emqx_ct_helpers:deps_path(emqx_authz, "etc/authorization_rules.conf") <<"path">> => emqx_ct_helpers:deps_path(emqx_authz, "etc/acl.conf")
}). }).

View File

@ -190,7 +190,7 @@ t_api(_) ->
, #{<<"type">> := <<"redis">>} , #{<<"type">> := <<"redis">>}
, #{<<"type">> := <<"file">>} , #{<<"type">> := <<"file">>}
], Sources), ], Sources),
?assert(filelib:is_file(filename:join([emqx:get_config([node, data_dir]), "authorization_rules.conf"]))), ?assert(filelib:is_file(filename:join([emqx:get_config([node, data_dir]), "acl.conf"]))),
{ok, 204, _} = request(put, uri(["authorization", "sources", "http"]), ?SOURCE1#{<<"enable">> := false}), {ok, 204, _} = request(put, uri(["authorization", "sources", "http"]), ?SOURCE1#{<<"enable">> := false}),
{ok, 200, Result3} = request(get, uri(["authorization", "sources", "http"]), []), {ok, 200, Result3} = request(get, uri(["authorization", "sources", "http"]), []),

View File

@ -340,7 +340,7 @@ relx_overlay(ReleaseType) ->
, {copy, "bin/emqx_ctl", "bin/emqx_ctl-{{release_version}}"} %% for relup , {copy, "bin/emqx_ctl", "bin/emqx_ctl-{{release_version}}"} %% for relup
, {copy, "bin/install_upgrade.escript", "bin/install_upgrade.escript-{{release_version}}"} %% for relup , {copy, "bin/install_upgrade.escript", "bin/install_upgrade.escript-{{release_version}}"} %% for relup
, {copy, "apps/emqx_gateway/src/lwm2m/lwm2m_xml", "etc/lwm2m_xml"} , {copy, "apps/emqx_gateway/src/lwm2m/lwm2m_xml", "etc/lwm2m_xml"}
, {copy, "apps/emqx_authz/etc/authorization_rules.conf", "etc/authorization_rules.conf"} , {copy, "apps/emqx_authz/etc/acl.conf", "etc/acl.conf"}
, {template, "bin/emqx.cmd", "bin/emqx.cmd"} , {template, "bin/emqx.cmd", "bin/emqx.cmd"}
, {template, "bin/emqx_ctl.cmd", "bin/emqx_ctl.cmd"} , {template, "bin/emqx_ctl.cmd", "bin/emqx_ctl.cmd"}
, {copy, "bin/nodetool", "bin/nodetool"} , {copy, "bin/nodetool", "bin/nodetool"}