2023-02-20 00:12:01 +08:00
|
|
|
// Copyright 2023 The Gitea Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package setting
|
|
|
|
|
2024-03-29 23:05:41 +08:00
|
|
|
import (
|
|
|
|
"code.gitea.io/gitea/modules/container"
|
|
|
|
)
|
2024-02-23 15:24:04 +08:00
|
|
|
|
2023-02-20 00:12:01 +08:00
|
|
|
// Admin settings
|
|
|
|
var Admin struct {
|
2024-03-29 23:05:41 +08:00
|
|
|
DisableRegularOrgCreation bool
|
|
|
|
DefaultEmailNotification string
|
|
|
|
UserDisabledFeatures container.Set[string]
|
|
|
|
ExternalUserDisableFeatures container.Set[string]
|
2023-02-20 00:12:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func loadAdminFrom(rootCfg ConfigProvider) {
|
|
|
|
sec := rootCfg.Section("admin")
|
2024-02-23 15:24:04 +08:00
|
|
|
Admin.DisableRegularOrgCreation = sec.Key("DISABLE_REGULAR_ORG_CREATION").MustBool(false)
|
2023-02-20 00:12:01 +08:00
|
|
|
Admin.DefaultEmailNotification = sec.Key("DEFAULT_EMAIL_NOTIFICATIONS").MustString("enabled")
|
2024-02-23 15:24:04 +08:00
|
|
|
Admin.UserDisabledFeatures = container.SetOf(sec.Key("USER_DISABLED_FEATURES").Strings(",")...)
|
2024-07-10 01:36:31 +08:00
|
|
|
Admin.ExternalUserDisableFeatures = container.SetOf(sec.Key("EXTERNAL_USER_DISABLE_FEATURES").Strings(",")...).Union(Admin.UserDisabledFeatures)
|
2023-02-20 00:12:01 +08:00
|
|
|
}
|
2024-02-23 15:24:04 +08:00
|
|
|
|
|
|
|
const (
|
2024-07-10 01:36:31 +08:00
|
|
|
UserFeatureDeletion = "deletion"
|
|
|
|
UserFeatureManageSSHKeys = "manage_ssh_keys"
|
|
|
|
UserFeatureManageGPGKeys = "manage_gpg_keys"
|
|
|
|
UserFeatureManageMFA = "manage_mfa"
|
|
|
|
UserFeatureManageCredentials = "manage_credentials"
|
2024-10-06 04:41:38 +08:00
|
|
|
UserFeatureChangeUsername = "change_username"
|
|
|
|
UserFeatureChangeFullName = "change_full_name"
|
2024-02-23 15:24:04 +08:00
|
|
|
)
|