chore: update changes

This commit is contained in:
firest 2024-06-06 16:42:43 +08:00
parent 5532c7b0a6
commit 3ae26c8a54
2 changed files with 3 additions and 14 deletions

View File

@ -487,7 +487,7 @@ users(post, #{body := Body}) when is_list(Body) ->
{error, {already_exists, Exists}} ->
{409, #{
code => <<"ALREADY_EXISTS">>,
message => binfmt("User '~ts' already exist", [binjoin(Exists)])
message => binfmt("User '~ts' already exist", [Exists])
}}
end.
@ -531,7 +531,7 @@ clients(post, #{body := Body}) when is_list(Body) ->
{error, {already_exists, Exists}} ->
{409, #{
code => <<"ALREADY_EXISTS">>,
message => binfmt("Client '~ts' already exist", [binjoin(Exists)])
message => binfmt("Client '~ts' already exist", [Exists])
}}
end.
@ -762,16 +762,4 @@ ensure_rules_is_valid(Key, Type, MaxLen, [Cfg | Cfgs]) ->
ensure_rules_is_valid(_Key, _Type, _MaxLen, []) ->
ok.
binjoin([Bin]) ->
Bin;
binjoin(Bins) when is_list(Bins) ->
binjoin(Bins, <<>>);
binjoin(Bin) ->
Bin.
binjoin([H | T], Acc) ->
binjoin(T, <<H/binary, $,, Acc/binary>>);
binjoin([], Acc) ->
Acc.
binfmt(Fmt, Args) -> iolist_to_binary(io_lib:format(Fmt, Args)).

View File

@ -0,0 +1 @@
In the built-in database of authorization, added a limit for the length of rules per client/user, and the default values is 100.