mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
feature(keystone): user add language attribute
User add language attribute, notify and alarm will use this attribute to send message in proper language
This commit is contained in:
@@ -57,6 +57,9 @@ func init() {
|
||||
),
|
||||
}
|
||||
UserManager.SetVirtualObject(UserManager)
|
||||
db.InitManager(func() {
|
||||
UserManager.TableSpec().ColumnSpec("lang").SetDefault(options.Options.DefaultUserLanguage)
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -93,6 +96,8 @@ type SUser struct {
|
||||
|
||||
AllowWebConsole tristate.TriState `nullable:"false" default:"true" list:"domain" update:"domain" create:"domain_optional"`
|
||||
EnableMfa tristate.TriState `nullable:"false" default:"false" list:"domain" update:"domain" create:"domain_optional"`
|
||||
|
||||
Lang string `width:"8" charset:"ascii" nullable:"false" list:"domain" update:"domain" create:"domain_optional"`
|
||||
}
|
||||
|
||||
func (manager *SUserManager) GetContextManagers() [][]db.IModelManager {
|
||||
@@ -664,6 +669,7 @@ func userExtra(user *SUser, out api.UserDetails) api.UserDetails {
|
||||
nextUpdate := update.Add(time.Duration(options.Options.FetchScopeResourceCountIntervalSeconds) * time.Second)
|
||||
out.ExtResourcesNextUpdate = nextUpdate
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ type SKeystoneOptions struct {
|
||||
SessionEndpointType string `help:"Client session end point type"`
|
||||
|
||||
AllowJoinProjectsAcrossDomains bool `help:"allow users/groups to join projects across domains" default:"false"`
|
||||
|
||||
DefaultUserLanguage string `help:"default user language, default to zh-CN" default:"zh-CN"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -73,5 +75,9 @@ func OnOptionsChange(oldOptions, newOptions interface{}) bool {
|
||||
changed = true
|
||||
}
|
||||
|
||||
if oldOpts.DefaultUserLanguage != newOpts.DefaultUserLanguage {
|
||||
changed = true
|
||||
}
|
||||
|
||||
return changed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user