Issue Summary
When using the Get managed accounts in an organization ** endpoint to get deactivated and deleted (pending for deletion state) account statuses, the results are inconsistent.
When looking at the closed or inactive status, we cannot differentiate accounts deactivated by the org admin from those deactivated by the IDP or from accounts pending deletion.
Steps to Reproduce
Use the Get managed accounts in an organization ** endpoint to get deactivated and deleted (pending for deletion state) account statuses.
Actual Results
The API returns:
- "account_status": "closed" for previously active accounts that were deleted and are in the "pending for deletion" state due to the 14-day grace period.
- When the account goes from Active to Deleted, we get the account status Closed __ from the API.
- "account_status": "inactive" for deactivated accounts, and also for deactivated accounts that were deleted and are in the "pending for deletion" state due to the 14-day grace period.
- When the account goes from Active to Deactivated and then Deleted, we get Inactive from the API as if the account was normally deactivated and not deleted.
- It seems the logic does not consider the last state.
- "account_status": "closed" for accounts deactivated by an identity provider through SCIM.
Expected Results
- "account_status": "closed" only for accounts pending for deletion.
- "account_status": "inactive" for any deactivated accounts, including ones deactivated by the identity provider
Workaround
Use the Search endpoint, as it returns Inactive for deactivated accounts regarding whether it is pending deletion or deactivated by the IDP.
Identity treats
blocked, deactivated and pending_deletion -> inactive state
deleted/tombstoned -> closed state
MAS infers this differently where it treats blocked as closed, so this should be bug on MAS side.