Skip to content

Commit

Permalink
KCRO-32: validation no longer uses crossbar_doc so the context db_doc…
Browse files Browse the repository at this point in the history
… is not set and billing relies on that (#6625)
  • Loading branch information
k-anderson authored Aug 28, 2020
1 parent 955667d commit ef352c4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion applications/crossbar/src/modules_v1/cb_users_v1.erl
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,14 @@ validate_request(UserId, Context) ->
AccountId = cb_context:account_id(Context),

case kzd_users:validate(AccountId, UserId, ReqJObj) of
{'true', UserJObj} when is_binary(UserId) ->
lager:debug("successfull validated user object update"),
%% NOTE: We need to load the current (unmodified) user document
%% into the cb_context KVS db_doc because billing uses that to
%% determine what changed and charge accordingly
cb_context:update_successfully_validated_request(load_user(UserId, Context), UserJObj);
{'true', UserJObj} ->
lager:debug("successfull validated user object"),
lager:debug("successfull validated user object create"),
cb_context:update_successfully_validated_request(Context, UserJObj);
{'validation_errors', ValidationErrors} ->
lager:info("validation errors on user"),
Expand Down
8 changes: 7 additions & 1 deletion applications/crossbar/src/modules_v2/cb_users_v2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,14 @@ validate_request(UserId, Context) ->
AccountId = cb_context:account_id(Context),

case kzd_users:validate(AccountId, UserId, ReqJObj) of
{'true', UserJObj} when is_binary(UserId) ->
lager:debug("successfull validated user object update"),
%% NOTE: We need to load the current (unmodified) user document
%% into the cb_context KVS db_doc because billing uses that to
%% determine what changed and charge accordingly
cb_context:update_successfully_validated_request(load_user(UserId, Context), UserJObj);
{'true', UserJObj} ->
lager:debug("successfull validated user object"),
lager:debug("successfull validated user object create"),
cb_context:update_successfully_validated_request(Context, UserJObj);
{'validation_errors', ValidationErrors} ->
lager:info("validation errors on user"),
Expand Down

0 comments on commit ef352c4

Please sign in to comment.