gitea源码

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2023 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package setting
  4. import (
  5. "code.gitea.io/gitea/modules/container"
  6. )
  7. // Admin settings
  8. var Admin struct {
  9. DisableRegularOrgCreation bool
  10. DefaultEmailNotification string
  11. UserDisabledFeatures container.Set[string]
  12. ExternalUserDisableFeatures container.Set[string]
  13. }
  14. func loadAdminFrom(rootCfg ConfigProvider) {
  15. sec := rootCfg.Section("admin")
  16. Admin.DisableRegularOrgCreation = sec.Key("DISABLE_REGULAR_ORG_CREATION").MustBool(false)
  17. Admin.DefaultEmailNotification = sec.Key("DEFAULT_EMAIL_NOTIFICATIONS").MustString("enabled")
  18. Admin.UserDisabledFeatures = container.SetOf(sec.Key("USER_DISABLED_FEATURES").Strings(",")...)
  19. Admin.ExternalUserDisableFeatures = container.SetOf(sec.Key("EXTERNAL_USER_DISABLE_FEATURES").Strings(",")...).Union(Admin.UserDisabledFeatures)
  20. }
  21. const (
  22. UserFeatureDeletion = "deletion"
  23. UserFeatureManageSSHKeys = "manage_ssh_keys"
  24. UserFeatureManageGPGKeys = "manage_gpg_keys"
  25. UserFeatureManageMFA = "manage_mfa"
  26. UserFeatureManageCredentials = "manage_credentials"
  27. UserFeatureChangeUsername = "change_username"
  28. UserFeatureChangeFullName = "change_full_name"
  29. )