Remove User after commit hook for assigning user to default organization
What does this MR do and why?
When the organization data structure was introduced, we ensured that all existing and new users got added to the Default Organization. This was achieved using an after_create_commit hook.
However, after finishing this issue, User create logic requires an organization_id to be set and we assign users to that organization. So this 'Default Organization' logic is no longer needed.
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Create a user using gdk:
- http://127.0.0.1:3000/admin/users/new Create a new user. After creation of the user, copy the user ID
- In a Rails console, execute
User.find(<user_id>).organizations, this should result in an array with one element - In a Rails console, execute
Users::Internal.duo_code_review_bot.organizations, this should also result in an array. Please note: if this user already exist in your database, it will not be recreated. In that case, you can consider deleting the user first