chore: apply suggestions from code review

Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
This commit is contained in:
JianBo He 2022-10-24 15:32:37 +08:00 committed by JianBo He
parent 4a9b5662f8
commit bd59197a58
3 changed files with 9 additions and 9 deletions

View File

@ -114,13 +114,13 @@ verify_acl(ClientInfo, Acl, PubSub, Topic) ->
subscribe -> <<"sub">>; subscribe -> <<"sub">>;
publish -> <<"pub">> publish -> <<"pub">>
end, end,
Rules0 = lists:foldl( Rules0 = lists:map(
fun(K, Acc) -> fun(K) ->
[case maps:get(K, Acl, undefined) of case maps:get(K, Acl, undefined) of
R when is_list(R) -> R; R when is_list(R) -> R;
_ -> [] _ -> []
end | Acc] end
end, [], [<<"all">>, Key]), end, [<<"all">>, Key]),
Rules = lists:append(Rules0), Rules = lists:append(Rules0),
verify_acl(ClientInfo, Rules, Topic). verify_acl(ClientInfo, Rules, Topic).

View File

@ -3,7 +3,7 @@
- Add a warning log if the ACL check failed for subscription [#9124](https://github.com/emqx/emqx/pull/9124). - Add a warning log if the ACL check failed for subscription [#9124](https://github.com/emqx/emqx/pull/9124).
This is to make the ACL deny logging for subscription behave the same as for publish. This is to make the ACL deny logging for subscription behave the same as for publish.
- JWT authorization supports the `all` rules [#9044](https://github.com/emqx/emqx/pull/9044). - JWT ACL claim supports `all` action to imply the rules applie to both `pub` and `sub` [#9044](https://github.com/emqx/emqx/pull/9044).
### Bug fixes ### Bug fixes

View File

@ -3,7 +3,7 @@
- 订阅时,如果 ACL 检查不通过,打印一个警告日志 [#9124](https://github.com/emqx/emqx/pull/9124)。 - 订阅时,如果 ACL 检查不通过,打印一个警告日志 [#9124](https://github.com/emqx/emqx/pull/9124)。
该行为的改变主要是为了跟发布失败时的行为保持一致。 该行为的改变主要是为了跟发布失败时的行为保持一致。
- 基于 JWT 的发布订阅授权支持 `all` 规则 [#9044](https://github.com/emqx/emqx/pull/9044)。 - 基于 JWT 的 ACL 支持 `all` 动作,指定同时适用于 `pub``sub` 两个动作的规则列表 [#9044](https://github.com/emqx/emqx/pull/9044)。
### 修复 ### 修复