Add a setting that allows for creation of new users with private profile
What does this MR do and why?
For #231301 (closed).
This MR:
- adds a migration to add a new column to ApplicationSetting table named
user_defaults_to_private_profile
, which is the instance setting. - Makes this instance setting is controllable via the Admin UI and the application setting API.
- Whenever a new user is created via the UI (via admin or a new signup) or the API, the value of this instance setting is respected, and is set as the value of
user.private_profile
- However, admins will have the ability to override this setting when creating a new user via the UI or API. In such cases, the instance setting is not respected, and the override is respected.
- Admins can also now modify existing users via the UI or the API to set the value of
user.private_profile
to eithertrue
orfalse
. When modifying an existing user's value of theprivate_profile
attribute, the instance setting is not respected.
Migrations
UP Migration
rake db:migrate
main: == 20221219135535 AddUserDefaultsToPrivateProfileToApplicationSettings: migrating
main: -- add_column(:application_settings, :user_defaults_to_private_profile, :boolean, {:default=>false, :null=>false})
main: -> 0.0049s
main: == 20221219135535 AddUserDefaultsToPrivateProfileToApplicationSettings: migrated (0.0104s)
ci: == 20221219135535 AddUserDefaultsToPrivateProfileToApplicationSettings: migrating
ci: -- add_column(:application_settings, :user_defaults_to_private_profile, :boolean, {:default=>false, :null=>false})
ci: -> 0.0047s
ci: == 20221219135535 AddUserDefaultsToPrivateProfileToApplicationSettings: migrated (0.0088s)
DOWN migration
rake db:migrate:down:main VERSION=20221219135535
main: == 20221219135535 AddUserDefaultsToPrivateProfileToApplicationSettings: reverting
main: -- remove_column(:application_settings, :user_defaults_to_private_profile, :boolean, {:default=>false, :null=>false})
main: -> 0.0031s
main: == 20221219135535 AddUserDefaultsToPrivateProfileToApplicationSettings: reverted (0.0066s)
rake db:migrate:down:ci VERSION=20221219135535
ci: == 20221219135535 AddUserDefaultsToPrivateProfileToApplicationSettings: reverting
ci: -- remove_column(:application_settings, :user_defaults_to_private_profile, :boolean, {:default=>false, :null=>false})
ci: -> 0.0032s
ci: == 20221219135535 AddUserDefaultsToPrivateProfileToApplicationSettings: reverted (0.0098s)
Screenshots or screen recordings
I have uploaded a walkthrough video on Unfiltered with all the details: https://youtu.be/X7afG0MBrOc (private, GitLab only)
Screenshots:
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #231301 (closed)
Edited by Manoj M J