Startup queries, foreign keys

This commit is contained in:
binwiederhier 2023-01-05 15:20:44 -05:00
parent 3280c2c440
commit 60f1882bec
14 changed files with 148 additions and 69 deletions

View file

@ -67,6 +67,7 @@ type Config struct {
CacheBatchSize int
CacheBatchTimeout time.Duration
AuthFile string
AuthStartupQueries string
AuthDefault user.Permission
AttachmentCacheDir string
AttachmentTotalSizeLimit int64
@ -104,11 +105,12 @@ type Config struct {
VisitorAccountCreateLimitReplenish time.Duration
BehindProxy bool
EnableWeb bool
EnableSignup bool
EnableSignup bool // Enable creation of accounts via API and UI
EnableLogin bool
EnableEmailConfirm bool
EnablePasswordReset bool
EnablePayments bool
EnableReserveTopics bool // Allow users with role "user" to own/reserve topics
Version string // injected by App
}

View file

@ -40,6 +40,9 @@ import (
message cache duration
Keep 10000 messages or keep X days?
Attachment expiration based on plan
plan:
weirdness with admin and "default" account
"account topic" sync mechanism
purge accounts that were not logged into in X
reset daily limits for users
max token issue limit
@ -165,7 +168,7 @@ func New(conf *Config) (*Server, error) {
}
var userManager *user.Manager
if conf.AuthFile != "" {
userManager, err = user.NewManager(conf.AuthFile, conf.AuthDefault)
userManager, err = user.NewManager(conf.AuthFile, conf.AuthStartupQueries, conf.AuthDefault)
if err != nil {
return nil, err
}
@ -453,6 +456,8 @@ func (s *Server) handleWebConfig(w http.ResponseWriter, _ *http.Request, _ *visi
EnableLogin: s.config.EnableLogin,
EnableSignup: s.config.EnableSignup,
EnablePasswordReset: s.config.EnablePasswordReset,
EnablePayments: s.config.EnablePayments,
EnableReserveTopics: s.config.EnableReserveTopics,
DisallowedTopics: disallowedTopics,
}
b, err := json.Marshal(response)

View file

@ -288,5 +288,6 @@ type apiConfigResponse struct {
EnableSignup bool `json:"enable_signup"`
EnablePasswordReset bool `json:"enable_password_reset"`
EnablePayments bool `json:"enable_payments"`
EnableReserveTopics bool `json:"enable_reserve_topics"`
DisallowedTopics []string `json:"disallowed_topics"`
}