lucas-a-martins opened a new pull request, #8743:
URL: https://github.com/apache/cloudstack/pull/8743

   ### Description
   
   ACS allows users to delete their own account by calling the `deleteAccount` 
API via CLI. Fixing this behavior has been previously suggested in this 
[comment](https://github.com/apache/cloudstack/pull/7242#issuecomment-1433260909).
 Furthermore, there's already a feature to prevent a user from deleting their 
own account via UI; however, slower environments create a small window where 
it's possible for the user to click the button before it's disabled, allowing 
deletion even through the UI (see this 
[comment](https://github.com/apache/cloudstack/pull/7242#issuecomment-1444300925)).
   
   This pull request addresses this issue by adding a validation that checks 
the `UUID` of the caller's account and compares it with the `UUID` of the 
account they are trying to delete. If they are the same, an exception is thrown.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [ ] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [x] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
![delete-account](https://github.com/apache/cloudstack/assets/56271185/09a6bfdf-65ca-42dd-a249-0539492d505e)
   
   ### How Has This Been Tested?
   
   I tested by creating a new account (Temp) and attempted to delete it using a 
user in this same account via CloudMonkey.
   As expected, an exception was thrown.
   
   Next, I attempted to delete the account via the UI by rapidly clicking the 
delete icon. Once again, an exception was thrown without deleting the account.
   
   ```
   "errortext": "The caller is requesting to delete their own account. As a 
security measure, ACS will not allow this operation.To delete account Temp (ID: 
510c8c3a-f2ab-4e42-8e52-55ac968b7291, Domain: 
ab95574f-7857-4a44-9510-2c72ccc770fe), request to another user with permission 
to execute the operation."
   ```


-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to