Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3] Upstream 4.3 added missing blacklist list to accounts schema updated relevant calls #6696

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions applications/crossbar/doc/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Accounts represent tenants or customers on the system. Each account represents a

Key | Description | Type | Default | Required | Support Level
--- | ----------- | ---- | ------- | -------- | -------------
`blacklists.[]` | | `string()` | | `false` |
`blacklists` | A list blacklist ids that apply to the account | `array(string())` | | `false` |
`call_recording.account` | endpoint recording settings | [#/definitions/call_recording](#call_recording) | | `false` |
`call_recording.endpoint` | endpoint recording settings | [#/definitions/call_recording](#call_recording) | | `false` |
`call_recording` | call recording configuration | `object()` | | `false` |
Expand Down
2 changes: 2 additions & 0 deletions applications/crossbar/doc/ref/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Accounts represent tenants or customers on the system. Each account represents a

Key | Description | Type | Default | Required | Support Level
--- | ----------- | ---- | ------- | -------- | -------------
`blacklists.[]` | | `string()` | | `false` |
`blacklists` | A list blacklist ids that apply to the account | `array(string())` | | `false` |
`call_recording.account` | endpoint recording settings | [#/definitions/call_recording](#call_recording) | | `false` |
`call_recording.endpoint` | endpoint recording settings | [#/definitions/call_recording](#call_recording) | | `false` |
`call_recording` | call recording configuration | `object()` | | `false` |
Expand Down
8 changes: 8 additions & 0 deletions applications/crossbar/priv/api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,14 @@
"accounts": {
"description": "Accounts represent tenants or customers on the system. Each account represents an individual dataset or sandbox that only one tenant can access. The data set is architecturally independent from other tenants.",
"properties": {
"blacklists": {
"description": "A list blacklist ids that apply to the account",
"items": {
"type": "string"
},
"type": "array",
"uniqueItems": true
},
"call_recording": {
"additionalProperties": false,
"description": "call recording configuration",
Expand Down
8 changes: 8 additions & 0 deletions applications/crossbar/priv/couchdb/schemas/accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
"_id": "accounts",
"description": "Accounts represent tenants or customers on the system. Each account represents an individual dataset or sandbox that only one tenant can access. The data set is architecturally independent from other tenants.",
"properties": {
"blacklists": {
"description": "A list blacklist ids that apply to the account",
"items": {
"type": "string"
},
"type": "array",
"uniqueItems": true
},
"call_recording": {
"additionalProperties": false,
"description": "call recording configuration",
Expand Down
2 changes: 1 addition & 1 deletion applications/stepswitch/src/stepswitch_inbound.erl
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ get_blacklists(AccountId) ->
lager:error("could not open account doc ~s : ~p", [AccountId, _R]),
E;
{'ok', Doc} ->
case kz_json:get_value(<<"blacklists">>, Doc, []) of
case kzd_accounts:blacklists(Doc, []) of
[] -> {'error', 'undefined'};
[_|_]=Blacklists-> {'ok', Blacklists};
_ -> {'error', 'miss_configured'}
Expand Down
13 changes: 13 additions & 0 deletions core/kazoo_documents/src/kzd_accounts.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-module(kzd_accounts).

-export([new/0]).
-export([blacklists/1, blacklists/2, set_blacklists/2]).
-export([call_recording/1, call_recording/2, set_call_recording/2]).
-export([call_recording_account/1, call_recording_account/2, set_call_recording_account/2]).
-export([call_recording_endpoint/1, call_recording_endpoint/2, set_call_recording_endpoint/2]).
Expand Down Expand Up @@ -140,6 +141,18 @@
new() ->
kz_doc:set_type(kz_json_schema:default_object(?SCHEMA), type()).

-spec blacklists(doc()) -> kz_term:api_ne_binaries().
blacklists(Doc) ->
blacklists(Doc, 'undefined').

-spec blacklists(doc(), Default) -> kz_term:ne_binaries() | Default.
blacklists(Doc, Default) ->
kz_json:get_list_value([<<"blacklists">>], Doc, Default).

-spec set_blacklists(doc(), kz_term:ne_binaries()) -> doc().
set_blacklists(Doc, Blacklists) ->
kz_json:set_value([<<"blacklists">>], Blacklists, Doc).

-spec call_recording(doc()) -> kz_term:api_object().
call_recording(Doc) ->
call_recording(Doc, 'undefined').
Expand Down
13 changes: 13 additions & 0 deletions core/kazoo_documents/src/kzd_accounts.erl.src
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-module(kzd_accounts).

-export([new/0]).
-export([blacklists/1, blacklists/2, set_blacklists/2]).
-export([call_recording/1, call_recording/2, set_call_recording/2]).
-export([call_recording_account/1, call_recording_account/2, set_call_recording_account/2]).
-export([call_recording_endpoint/1, call_recording_endpoint/2, set_call_recording_endpoint/2]).
Expand Down Expand Up @@ -62,6 +63,18 @@
new() ->
kz_json_schema:default_object(?SCHEMA).

-spec blacklists(doc()) -> kz_term:api_ne_binaries().
blacklists(Doc) ->
blacklists(Doc, 'undefined').

-spec blacklists(doc(), Default) -> kz_term:ne_binaries() | Default.
blacklists(Doc, Default) ->
kz_json:get_list_value([<<"blacklists">>], Doc, Default).

-spec set_blacklists(doc(), kz_term:ne_binaries()) -> doc().
set_blacklists(Doc, Blacklists) ->
kz_json:set_value([<<"blacklists">>], Blacklists, Doc).

-spec call_recording(doc()) -> kz_term:api_object().
call_recording(Doc) ->
call_recording(Doc, 'undefined').
Expand Down