Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkonstpic <156318483+konstpic@users.noreply.github.com>2025-09-28 22:00:16 +0300
committermhsanaei <ho3ein.sanaei@gmail.com>2025-09-28 22:04:54 +0300
commit28a17a80ec0c4a0f82e8acfca351651d762b3ec9 (patch)
tree7902b7b4cba04bce816ad17c9490f7228574a096 /web/service/setting.go
parent30565833889171afe5c934f97bc0e767534e8310 (diff)
feat: add ldap component (#3568)
* add ldap component * fix: fix russian comments, tls cert verify default true * feat: remove replaces go mod for local dev
Diffstat (limited to 'web/service/setting.go')
-rw-r--r--web/service/setting.go102
1 files changed, 102 insertions, 0 deletions
diff --git a/web/service/setting.go b/web/service/setting.go
index fc6513c5..fa85d58c 100644
--- a/web/service/setting.go
+++ b/web/service/setting.go
@@ -73,6 +73,27 @@ var defaultValueMap = map[string]string{
"warp": "",
"externalTrafficInformEnable": "false",
"externalTrafficInformURI": "",
+ // LDAP defaults
+ "ldapEnable": "false",
+ "ldapHost": "",
+ "ldapPort": "389",
+ "ldapUseTLS": "false",
+ "ldapBindDN": "",
+ "ldapPassword": "",
+ "ldapBaseDN": "",
+ "ldapUserFilter": "(objectClass=person)",
+ "ldapUserAttr": "mail",
+ "ldapVlessField": "vless_enabled",
+ "ldapSyncCron": "@every 1m",
+ "ldapFlagField": "",
+ "ldapTruthyValues": "true,1,yes,on",
+ "ldapInvertFlag": "false",
+ "ldapInboundTags": "",
+ "ldapAutoCreate": "false",
+ "ldapAutoDelete": "false",
+ "ldapDefaultTotalGB": "0",
+ "ldapDefaultExpiryDays": "0",
+ "ldapDefaultLimitIP": "0",
}
// SettingService provides business logic for application settings management.
@@ -542,6 +563,87 @@ func (s *SettingService) GetIpLimitEnable() (bool, error) {
return (accessLogPath != "none" && accessLogPath != ""), nil
}
+// LDAP exported getters
+func (s *SettingService) GetLdapEnable() (bool, error) {
+ return s.getBool("ldapEnable")
+}
+
+func (s *SettingService) GetLdapHost() (string, error) {
+ return s.getString("ldapHost")
+}
+
+func (s *SettingService) GetLdapPort() (int, error) {
+ return s.getInt("ldapPort")
+}
+
+func (s *SettingService) GetLdapUseTLS() (bool, error) {
+ return s.getBool("ldapUseTLS")
+}
+
+func (s *SettingService) GetLdapBindDN() (string, error) {
+ return s.getString("ldapBindDN")
+}
+
+func (s *SettingService) GetLdapPassword() (string, error) {
+ return s.getString("ldapPassword")
+}
+
+func (s *SettingService) GetLdapBaseDN() (string, error) {
+ return s.getString("ldapBaseDN")
+}
+
+func (s *SettingService) GetLdapUserFilter() (string, error) {
+ return s.getString("ldapUserFilter")
+}
+
+func (s *SettingService) GetLdapUserAttr() (string, error) {
+ return s.getString("ldapUserAttr")
+}
+
+func (s *SettingService) GetLdapVlessField() (string, error) {
+ return s.getString("ldapVlessField")
+}
+
+func (s *SettingService) GetLdapSyncCron() (string, error) {
+ return s.getString("ldapSyncCron")
+}
+
+func (s *SettingService) GetLdapFlagField() (string, error) {
+ return s.getString("ldapFlagField")
+}
+
+func (s *SettingService) GetLdapTruthyValues() (string, error) {
+ return s.getString("ldapTruthyValues")
+}
+
+func (s *SettingService) GetLdapInvertFlag() (bool, error) {
+ return s.getBool("ldapInvertFlag")
+}
+
+func (s *SettingService) GetLdapInboundTags() (string, error) {
+ return s.getString("ldapInboundTags")
+}
+
+func (s *SettingService) GetLdapAutoCreate() (bool, error) {
+ return s.getBool("ldapAutoCreate")
+}
+
+func (s *SettingService) GetLdapAutoDelete() (bool, error) {
+ return s.getBool("ldapAutoDelete")
+}
+
+func (s *SettingService) GetLdapDefaultTotalGB() (int, error) {
+ return s.getInt("ldapDefaultTotalGB")
+}
+
+func (s *SettingService) GetLdapDefaultExpiryDays() (int, error) {
+ return s.getInt("ldapDefaultExpiryDays")
+}
+
+func (s *SettingService) GetLdapDefaultLimitIP() (int, error) {
+ return s.getInt("ldapDefaultLimitIP")
+}
+
func (s *SettingService) UpdateAllSetting(allSetting *entity.AllSetting) error {
if err := allSetting.CheckValid(); err != nil {
return err