aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-02-23 15:24:04 +0800
committerGitHub <noreply@github.com>2024-02-23 07:24:04 +0000
commit3ef6252e06a1f3981f8b7d1717bfc581418b1dc5 (patch)
tree9ff3962b5b33d3f08e13259eb8d4ebc7c2f228e3 /modules/setting
parent7fbdb60fc1152acc9a040dc04b1b0f5a3475b081 (diff)
downloadgitea-3ef6252e06a1f3981f8b7d1717bfc581418b1dc5.tar.gz
gitea-3ef6252e06a1f3981f8b7d1717bfc581418b1dc5.zip
Allow options to disable user deletion from the interface on app.ini (#29275)
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. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/admin.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/setting/admin.go b/modules/setting/admin.go
index 2d2dd26de9..48a2ea9744 100644
--- a/modules/setting/admin.go
+++ b/modules/setting/admin.go
@@ -3,14 +3,22 @@
package setting
+import "code.gitea.io/gitea/modules/container"
+
// Admin settings
var Admin struct {
DisableRegularOrgCreation bool
DefaultEmailNotification string
+ UserDisabledFeatures container.Set[string]
}
func loadAdminFrom(rootCfg ConfigProvider) {
- mustMapSetting(rootCfg, "admin", &Admin)
sec := rootCfg.Section("admin")
+ Admin.DisableRegularOrgCreation = sec.Key("DISABLE_REGULAR_ORG_CREATION").MustBool(false)
Admin.DefaultEmailNotification = sec.Key("DEFAULT_EMAIL_NOTIFICATIONS").MustString("enabled")
+ Admin.UserDisabledFeatures = container.SetOf(sec.Key("USER_DISABLED_FEATURES").Strings(",")...)
}
+
+const (
+ UserFeatureDeletion = "deletion"
+)