SURYAS1306 opened a new pull request, #12607:
URL: https://github.com/apache/cloudstack/pull/12607

   ### Description
   
   When attempting to delete an account, CloudStack currently blocks the 
deletion if the
   account is listed as an administrator of any project, even when those 
projects have
   already been deleted (i.e. `removed` is not null).
   
   This leads to a misleading error and prevents valid account deletion for 
accounts that
   only manage already-deleted projects.
   
   This PR improves the account deletion flow by ensuring that only **active** 
projects
   are considered when checking whether an account manages projects. Deleted 
projects are
   ignored, allowing the account deletion to proceed correctly.
   
   A unit test has been added to validate this behavior and prevent regressions.
   
   Fixes #12601
   
   ---
   
   ### Expected behavior
   
   An account should be deletable if it only manages projects that have already 
been deleted.
   
   ---
   
   ### Actual behavior
   
   Account deletion fails with an error indicating that the account manages 
projects,
   even when all associated projects are already deleted.
   
   ---
   
   ### Types of changes
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [x] Test (unit test code)
   
   ---
   
   ### Bug Severity
   
   - [x] Minor
   
   ---
   
   ### How Has This Been Tested?
   
   - Added a unit test in `AccountManagerImplTest` to verify that an account 
managing
     only deleted projects does **not** cause account deletion to fail.
   - Verified that the account deletion logic continues to block deletion when 
the
     account manages active projects.
   - Built the affected CloudStack modules locally using Maven.
   
   ---
   
   ### How did you try to break this feature and the system with this change?
   
   - Simulated scenarios where an account manages:
     - only deleted projects
     - a mix of active and deleted projects
   - Confirmed that deletion is allowed only when **no active projects** are 
managed,
     and correctly blocked otherwise.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to