Sanitize personal information out of license for non system admin users (#3487)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
8b918efd3f
Коммит
f89e7c6d54
@@ -890,7 +890,11 @@ func getInitialLoad(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
il.ClientCfg = utils.ClientCfg
|
||||
il.LicenseCfg = utils.ClientLicense
|
||||
if c.IsSystemAdmin() {
|
||||
il.LicenseCfg = utils.ClientLicense
|
||||
} else {
|
||||
il.LicenseCfg = utils.GetSantizedClientLicense()
|
||||
}
|
||||
|
||||
w.Write([]byte(il.ToJson()))
|
||||
}
|
||||
|
||||
@@ -230,7 +230,6 @@ func getClientConfig(c *model.Config) map[string]string {
|
||||
props["EnableSignInWithEmail"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithEmail)
|
||||
props["EnableSignInWithUsername"] = strconv.FormatBool(*c.EmailSettings.EnableSignInWithUsername)
|
||||
props["RequireEmailVerification"] = strconv.FormatBool(c.EmailSettings.RequireEmailVerification)
|
||||
props["FeedbackEmail"] = c.EmailSettings.FeedbackEmail
|
||||
|
||||
props["EnableSignUpWithGitLab"] = strconv.FormatBool(c.GitLabSettings.Enable)
|
||||
props["EnableSignUpWithGoogle"] = strconv.FormatBool(c.GoogleSettings.Enable)
|
||||
|
||||
@@ -146,3 +146,23 @@ func GetClientLicenseEtag() string {
|
||||
|
||||
return model.Etag(fmt.Sprintf("%x", md5.Sum([]byte(value))))
|
||||
}
|
||||
|
||||
func GetSantizedClientLicense() map[string]string {
|
||||
sanitizedLicense := make(map[string]string)
|
||||
|
||||
for k, v := range ClientLicense {
|
||||
sanitizedLicense[k] = v
|
||||
}
|
||||
|
||||
if IsLicensed {
|
||||
delete(sanitizedLicense, "Name")
|
||||
delete(sanitizedLicense, "Email")
|
||||
delete(sanitizedLicense, "Company")
|
||||
delete(sanitizedLicense, "PhoneNumber")
|
||||
delete(sanitizedLicense, "IssuedAt")
|
||||
delete(sanitizedLicense, "StartsAt")
|
||||
delete(sanitizedLicense, "ExpiresAt")
|
||||
}
|
||||
|
||||
return sanitizedLicense
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user