Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow options to disable user deletion from the interface on app.ini #29275

Merged
merged 14 commits into from
Feb 23, 2024

Conversation

lunny
Copy link
Member

@lunny lunny commented Feb 20, 2024

Extract from #20549

This PR added a new option on app.ini [admin]USER_DISABLED_FEATURES to allow the site administrator to disable users visiting deletion user interface or allow.
This options are also potentially allowed to define more features in future PRs.

@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Feb 20, 2024
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 20, 2024
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 20, 2024
@lunny lunny added this to the 1.22.0 milestone Feb 20, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 21, 2024
routers/web/web.go Outdated Show resolved Hide resolved
@@ -403,6 +403,14 @@ func registerRoutes(m *web.Route) {
}
}

userSettingModuleEnabled := func(module string) func(ctx *context.Context) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems an over-engendering. It could be simply checked in user_setting.DeleteAccount, instead of bloating the "web.go", it has been much too large.

modules/setting/user.go Outdated Show resolved Hide resolved
modules/setting/user.go Outdated Show resolved Hide resolved
@@ -565,7 +573,7 @@ func registerRoutes(m *web.Route) {
m.Combo("").Get(user_setting.Account).Post(web.Bind(forms.ChangePasswordForm{}), user_setting.AccountPost)
m.Post("/email", web.Bind(forms.AddEmailForm{}), user_setting.EmailPost)
m.Post("/email/delete", user_setting.DeleteEmail)
m.Post("/delete", user_setting.DeleteAccount)
m.Post("/delete", userSettingModuleEnabled(setting.UserDeletionKey), user_setting.DeleteAccount)
Copy link
Contributor

@wxiaoguang wxiaoguang Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need some test code for the DeleteAccount request?

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 21, 2024
@pull-request-size pull-request-size bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 21, 2024
…user settings, it can also affect others of user
@pull-request-size pull-request-size bot removed the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 23, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 23, 2024
@lunny
Copy link
Member Author

lunny commented Feb 23, 2024

I renamed it to USER_DISABLED_FEATURES but not USER_SETTINGS_DISABLED_FEATURES so that we can also add other user-related features.

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some changes, not tested yet, overall LGTM

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 23, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 23, 2024
@lunny lunny enabled auto-merge (squash) February 23, 2024 07:01
@lunny lunny merged commit 3ef6252 into go-gitea:main Feb 23, 2024
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 23, 2024
@lunny lunny deleted the lunny/user_options branch February 23, 2024 07:44
zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 23, 2024
* giteaofficial/main:
  Adjust changelog for v1.21.6 to move prs to correct labels (go-gitea#29339) (go-gitea#29343)
  Allow options to disable user deletion from the interface on app.ini (go-gitea#29275)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/docs size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants