mirror of
https://github.com/valitydev/bouncer.git
synced 2024-11-06 02:15:18 +00:00
Don't audit-log 'undefined' when no restrictions (#17)
This commit is contained in:
parent
85c7edeb6e
commit
db9721bf71
@ -214,12 +214,11 @@ get_beat_metadata({judgement, Event}) ->
|
|||||||
event => started
|
event => started
|
||||||
};
|
};
|
||||||
{completed, {Resolution, Assertions}} ->
|
{completed, {Resolution, Assertions}} ->
|
||||||
#{
|
encode_restrictions(Resolution, #{
|
||||||
event => completed,
|
event => completed,
|
||||||
resolution => encode_resolution(Resolution),
|
resolution => encode_resolution(Resolution),
|
||||||
assertions => lists:map(fun encode_assertion/1, Assertions),
|
assertions => lists:map(fun encode_assertion/1, Assertions)
|
||||||
restrictions => encode_restrictions(Resolution)
|
});
|
||||||
};
|
|
||||||
{failed, Error} ->
|
{failed, Error} ->
|
||||||
#{
|
#{
|
||||||
event => failed,
|
event => failed,
|
||||||
@ -234,10 +233,10 @@ encode_resolution({restricted, _Restrictions}) -> <<"restricted">>.
|
|||||||
|
|
||||||
%% NOTE
|
%% NOTE
|
||||||
%% I judged adding restrictions parsing to be not worth it for audit log
|
%% I judged adding restrictions parsing to be not worth it for audit log
|
||||||
encode_restrictions({restricted, Restrictions}) ->
|
encode_restrictions({restricted, Restrictions}, Acc) ->
|
||||||
Restrictions;
|
Acc#{restrictions => Restrictions};
|
||||||
encode_restrictions(_) ->
|
encode_restrictions(_, Acc) ->
|
||||||
undefined.
|
Acc.
|
||||||
|
|
||||||
encode_assertion({Code, Details}) ->
|
encode_assertion({Code, Details}) ->
|
||||||
#{code => Code, details => Details}.
|
#{code => Code, details => Details}.
|
||||||
|
Loading…
Reference in New Issue
Block a user