chore(authorization): merge authorization in emqx and emqx_authz

This commit is contained in:
zhanghongtong 2021-08-25 16:09:54 +08:00 committed by Rory Z
parent 856d394860
commit 4594d2d42b
3 changed files with 11 additions and 7 deletions

View File

@ -1,9 +1,5 @@
authorization_rules { authorization {
rules = [ rules = [
# {
# type: file
# path: {{ platform_etc_dir }}/authorization_rules.conf
# },
# { # {
# type: http # type: http
# config: { # config: {
@ -68,6 +64,10 @@ authorization_rules {
# } # }
# collection: mqtt_authz # collection: mqtt_authz
# find: { "$or": [ { "username": "%u" }, { "clientid": "%c" } ] } # find: { "$or": [ { "username": "%u" }, { "clientid": "%c" } ] }
# },
# {
# type: file
# path: {{ platform_etc_dir }}/authorization_rules.conf
# } # }
] ]
} }

View File

@ -17,9 +17,9 @@
, fields/1 , fields/1
]). ]).
structs() -> ["authorization_rules"]. structs() -> ["authorization"].
fields("authorization_rules") -> fields("authorization") ->
[ {rules, rules()} [ {rules, rules()}
]; ];
fields(file) -> fields(file) ->

View File

@ -197,6 +197,10 @@ fields("log_burst_limit") ->
, {"window_time", t(emqx_schema:duration(), undefined, "1s")} , {"window_time", t(emqx_schema:duration(), undefined, "1s")}
]; ];
fields("authorization") ->
emqx_schema:fields("authorization") ++
emqx_authz_schema:fields("authorization");
fields(Name) -> fields(Name) ->
find_field(Name, ?MERGED_CONFIGS). find_field(Name, ?MERGED_CONFIGS).