When the OrgUser is deleted, since it is the last TenantUser, its API key is not being deleted from the Platform

Description

PRDE - Bug default text according to the team DoR (Definition of Ready)

01 - PERSON OF CONTACT (PERSON THAT CAN ANSWER QUESTIONS ABOUT THE PROBLEM):

@Douglas Coimbra Lopes

02 - PROBLEM (WHAT'S THE ISSUE?):

  • When the OrgUser is deleted since it is the last TenantUser, its API key is not deleted from the Platform
  • This case was found during Automation Work by the QA team
  • The Org User was not found since it was deleted

  • However, its API Token is still available on the platform

03 - STEPS TO REPRODUCE (STEP (1...N), VIDEO, SCREENSHOTS, LOGS FOLDER, HEARTBEAT, ETC. – IF IS NOT POSSIBLE TO REPRODUCE EXPLAIN THE REASON):

  • Create a New user in a single tenant
  • With this user, create a new API Key
  • As Org Admin Delete the OrgUser from this organization
  • Check the API Key still available

04 - LINKS (ADD A LINK TO THE BUG OR TO THE TENANT):
05 - EXPECTED BEHAVIOR (LIST THE EXPECTED BEHAVIORS TO CONSIDER THIS BUG AS DONE):

  • When the Tenant User that generated the API Key is deleted, the API KEY must be deleted
  • When the Org User that generated the API Key is deleted, the API KEY must be deleted.