Restcomm-Connect
Restcomm-Connect copied to clipboard
Restcomm 2497: implement suspend account
What this PR does / why we need it:
Currently we can only update an account to Closed
state, which means all related resources (DIDs, Clients etc) will be removed and Account will be inactive.
From this state there is no way to get back to Active
.
For this reason we need to implement the Suspended
state which means, Account and account's resources (DIDs, Clients etc) cannot operate but are not deleted. At any time a Suspended
account can move to either Active
or Closed
state
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):
Fixes #2497
Special notes for your reviewer: Following regression tests are added as @gsaslis recommend:
- No REST API request is allowed for a
SUSPENDED
account. Account cannot login, create calls, search DID etc. - All resources (apps, clients, DIDs etc) are suspended and cannot be used. Clients cannot be registered, DID numbers return 403
- All sub-accounts of the account and their resources are also suspended and cannot be used.
- The Account, Sub-Accounts and all related resources still exist / are not removed from db.
- A suspended account can move to either
CLOSED
state or toACTIVE
state again. - Moving to
ACTIVE
state means that Account and sub-accounts are active and can be used again, same for all related resources. - Moving to
CLOSED
state means that Account, sub-accounts and related resources are closed forever and will be never used again. External resources like, purchased DID number will be released (so no more costs) but everything else (account, sub-account, resources) will remain in the DB for audit purposes.
Hi @gsaslis , In current design, each time we update account status, we also update status of its sub-accounts. Please check this piece of code switchAccountStatusTree
I have one concern here, what if the account is suspended then activated again so the suspended/inactive/uninitialized sub-accounts will be activated too.
This could be our new expectation: update sub-account's status regarding to the parent account's status, right? Do you have any idea for this situation?
@ddhuy thanks for the new PR. This is much clearer.
with regards to your particular question, I will say the same thing I had replied back then: https://github.com/RestComm/Restcomm-Connect/issues/2497#issuecomment-347610760
Plz do feel free to let me know if that's not clear or you need any further clarification there.
@gsaslis thank you for your comment. I understand your point. But with current implementation in our source code, the sub-account status is updated according to parent account status. Please have look at this function switchAccountTree. This function is called whenever we update one account status. I already tried to test this behavior, and observed the same problem.