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

   ### Description
   
   If a user that is associated to a project gets deleted, other users become 
unable to see who belongs to the project via `listProjectAccounts` due to a 
NPE. This happens because the removed user is still associated with the project.
   
   This PR fixes the issue by removing the user from all projects before 
deleting it (as we already do with accounts). To normalize environments that 
are affected by the bug, the following script will be executed during the 
upgrade in order to delete project-user associations for users that were 
removed.
   
   ```sql
   DELETE FROM `cloud`.`project_account` WHERE `user_id` IN (SELECT `id` FROM 
`cloud`.`user` WHERE `removed`);
   ```
   
   Fixes #9974
   
   ### 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)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [X] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### How Has This Been Tested?
   
   #### User clean-up on deletion
   
   1. I created a project
   2. I added a user to the project
   3. I deleted the user
   
   After step 3, I would become unable to list accounts/users that belong to 
the project via `listProjectAccounts` before the changes. With the changes, I 
was able to list them normally.
   
   #### Normalization of affected environments
   
   Before applying the patch, I created some broken projects by deleting their 
users. Then, I executed the upgrade script and verified that I was able to list 
their accounts/users normally.


-- 
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