diff options
Diffstat (limited to 'web/service/setting.go')
| -rw-r--r-- | web/service/setting.go | 102 |
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 |
