Browse Source

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

zhanghongtong 4 years ago
parent
commit
1699a8dc63

apps/emqx_authz/etc/authorization_rules.conf → apps/emqx_authz/etc/acl.conf


+ 1 - 1
apps/emqx_authz/etc/emqx_authz.conf

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

+ 2 - 2
apps/emqx_authz/src/emqx_authz_api_sources.erl

@@ -330,7 +330,7 @@ sources(get, _) ->
                         end, [], emqx_authz:lookup()),
     {200, #{sources => Sources}};
 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])
                                ),
     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
                 case Source of
                     #{<<"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])
                                                    ),
                         #{type => file, enable => Enable, path => Filename};

+ 1 - 1
apps/emqx_authz/test/emqx_authz_SUITE.erl

@@ -111,7 +111,7 @@ init_per_testcase(_, Config) ->
                   }).
 -define(SOURCE6, #{<<"type">> => <<"file">>,
                    <<"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")
                   }).
 
 

+ 1 - 1
apps/emqx_authz/test/emqx_authz_api_sources_SUITE.erl

@@ -190,7 +190,7 @@ t_api(_) ->
                  , #{<<"type">> := <<"redis">>}
                  , #{<<"type">> := <<"file">>}
                  ], 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, 200, Result3} = request(get, uri(["authorization", "sources", "http"]), []),

+ 1 - 1
rebar.config.erl

@@ -340,7 +340,7 @@ relx_overlay(ReleaseType) ->
     , {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, "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_ctl.cmd", "bin/emqx_ctl.cmd"}
     , {copy, "bin/nodetool", "bin/nodetool"}