فهرست منبع

chore(authz): rename ACL to AuthZ

Rory Z 4 سال پیش
والد
کامیت
45ee504dc5

+ 1 - 1
apps/emqx_authz/README.md

@@ -131,7 +131,7 @@ Sample data in the default configuration:
 HSET mqtt_acl:emqx '$SYS/#' subscribe
 HSET mqtt_acl:emqx '$SYS/#' subscribe
 ```
 ```
 
 
-A rule of Redis ACL defines `publish`, `subscribe`, or `all `information. All lists in the rule are **allow** lists.
+A rule of Redis AuthZ defines `publish`, `subscribe`, or `all `information. All lists in the rule are **allow** lists.
 
 
 #### Mongo
 #### Mongo
 
 

+ 6 - 6
apps/emqx_authz/include/emqx_authz.hrl

@@ -6,14 +6,14 @@
 -define(ALLOW_DENY(A), ((A =:= allow) orelse (A =:= deny))).
 -define(ALLOW_DENY(A), ((A =:= allow) orelse (A =:= deny))).
 -define(PUBSUB(A), ((A =:= subscribe) orelse (A =:= publish) orelse (A =:= all))).
 -define(PUBSUB(A), ((A =:= subscribe) orelse (A =:= publish) orelse (A =:= all))).
 
 
--record(acl_metrics, {
-        allow = 'client.acl.allow',
-        deny = 'client.acl.deny',
-        ignore = 'client.acl.ignore'
+-record(authz_metrics, {
+        allow = 'client.authorize.allow',
+        deny = 'client.authorize.deny',
+        ignore = 'client.authorize.ignore'
     }).
     }).
 
 
 -define(METRICS(Type), tl(tuple_to_list(#Type{}))).
 -define(METRICS(Type), tl(tuple_to_list(#Type{}))).
 -define(METRICS(Type, K), #Type{}#Type.K).
 -define(METRICS(Type, K), #Type{}#Type.K).
 
 
--define(ACL_METRICS, ?METRICS(acl_metrics)).
--define(ACL_METRICS(K), ?METRICS(acl_metrics, K)).
+-define(AUTHZ_METRICS, ?METRICS(authz_metrics)).
+-define(AUTHZ_METRICS(K), ?METRICS(authz_metrics, K)).

+ 5 - 5
apps/emqx_authz/src/emqx_authz.erl

@@ -32,7 +32,7 @@
 
 
 -spec(register_metrics() -> ok).
 -spec(register_metrics() -> ok).
 register_metrics() ->
 register_metrics() ->
-    lists:foreach(fun emqx_metrics:ensure/1, ?ACL_METRICS).
+    lists:foreach(fun emqx_metrics:ensure/1, ?AUTHZ_METRICS).
 
 
 init() ->
 init() ->
     ok = register_metrics(),
     ok = register_metrics(),
@@ -147,10 +147,10 @@ b2l(B) when is_list(B) -> B;
 b2l(B) when is_binary(B) -> binary_to_list(B).
 b2l(B) when is_binary(B) -> binary_to_list(B).
 
 
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------
-%% ACL callbacks
+%% AuthZ callbacks
 %%--------------------------------------------------------------------
 %%--------------------------------------------------------------------
 
 
-%% @doc Check ACL
+%% @doc Check AuthZ
 -spec(authorize(emqx_types:clientinfo(), emqx_types:all(), emqx_topic:topic(), emqx_permission_rule:acl_result(), rules())
 -spec(authorize(emqx_types:clientinfo(), emqx_types:all(), emqx_topic:topic(), emqx_permission_rule:acl_result(), rules())
       -> {stop, allow} | {ok, deny}).
       -> {stop, allow} | {ok, deny}).
 authorize(#{username := Username,
 authorize(#{username := Username,
@@ -159,11 +159,11 @@ authorize(#{username := Username,
     case do_authorize(Client, PubSub, Topic, Rules) of
     case do_authorize(Client, PubSub, Topic, Rules) of
         {matched, allow} ->
         {matched, allow} ->
             ?LOG(info, "Client succeeded authorization: Username: ~p, IP: ~p, Topic: ~p, Permission: allow", [Username, IpAddress, Topic]),
             ?LOG(info, "Client succeeded authorization: Username: ~p, IP: ~p, Topic: ~p, Permission: allow", [Username, IpAddress, Topic]),
-            emqx_metrics:inc(?ACL_METRICS(allow)),
+            emqx_metrics:inc(?AUTHZ_METRICS(allow)),
             {stop, allow};
             {stop, allow};
         {matched, deny} ->
         {matched, deny} ->
             ?LOG(info, "Client failed authorization: Username: ~p, IP: ~p, Topic: ~p, Permission: deny", [Username, IpAddress, Topic]),
             ?LOG(info, "Client failed authorization: Username: ~p, IP: ~p, Topic: ~p, Permission: deny", [Username, IpAddress, Topic]),
-            emqx_metrics:inc(?ACL_METRICS(deny)),
+            emqx_metrics:inc(?AUTHZ_METRICS(deny)),
             {stop, deny};
             {stop, deny};
         nomatch ->
         nomatch ->
             ?LOG(info, "Client failed authorization: Username: ~p, IP: ~p, Topic: ~p, Reasion: ~p", [Username, IpAddress, Topic, "no-match rule"]),
             ?LOG(info, "Client failed authorization: Username: ~p, IP: ~p, Topic: ~p, Reasion: ~p", [Username, IpAddress, Topic, "no-match rule"]),

+ 1 - 1
apps/emqx_authz/src/emqx_authz_mongo.erl

@@ -20,7 +20,7 @@
 -include_lib("emqx/include/emqx.hrl").
 -include_lib("emqx/include/emqx.hrl").
 -include_lib("emqx/include/logger.hrl").
 -include_lib("emqx/include/logger.hrl").
 
 
-%% ACL Callbacks
+%% AuthZ Callbacks
 -export([ authorize/4
 -export([ authorize/4
         , description/0
         , description/0
         ]).
         ]).

+ 1 - 1
apps/emqx_authz/src/emqx_authz_mysql.erl

@@ -20,7 +20,7 @@
 -include_lib("emqx/include/emqx.hrl").
 -include_lib("emqx/include/emqx.hrl").
 -include_lib("emqx/include/logger.hrl").
 -include_lib("emqx/include/logger.hrl").
 
 
-%% ACL Callbacks
+%% AuthZ Callbacks
 -export([ description/0
 -export([ description/0
         , parse_query/1
         , parse_query/1
         , authorize/4
         , authorize/4

+ 1 - 1
apps/emqx_authz/src/emqx_authz_pgsql.erl

@@ -20,7 +20,7 @@
 -include_lib("emqx/include/emqx.hrl").
 -include_lib("emqx/include/emqx.hrl").
 -include_lib("emqx/include/logger.hrl").
 -include_lib("emqx/include/logger.hrl").
 
 
-%% ACL Callbacks
+%% AuthZ Callbacks
 -export([ description/0
 -export([ description/0
         , parse_query/1
         , parse_query/1
         , authorize/4
         , authorize/4

+ 1 - 1
apps/emqx_authz/src/emqx_authz_redis.erl

@@ -20,7 +20,7 @@
 -include_lib("emqx/include/emqx.hrl").
 -include_lib("emqx/include/emqx.hrl").
 -include_lib("emqx/include/logger.hrl").
 -include_lib("emqx/include/logger.hrl").
 
 
-%% ACL Callbacks
+%% AuthZ Callbacks
 -export([ authorize/4
 -export([ authorize/4
         , description/0
         , description/0
         ]).
         ]).