PLT-6268 Clear blue bar correctly when removing expiring license (#6247)

* Don't sanitize license for system admin

* Clear blue bar error whe removing expiring license

* Fix unit test
This commit is contained in:
Joram Wilander
2017-04-27 10:57:58 -04:00
committed by Corey Hulen
parent 9a87bb3af6
commit 5a60ea0d75
3 changed files with 18 additions and 1 deletions

View File

@@ -231,6 +231,14 @@ func getClientLicense(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
var clientLicense map[string]string
if app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
clientLicense = utils.ClientLicense
} else {
clientLicense = utils.GetSanitizedClientLicense()
}
w.Header().Set(model.HEADER_ETAG_SERVER, etag)
w.Write([]byte(model.MapToJson(utils.GetSanitizedClientLicense())))
w.Write([]byte(model.MapToJson(clientLicense)))
}

View File

@@ -180,6 +180,13 @@ func TestGetOldClientLicense(t *testing.T) {
if _, err := Client.DoApiGet("/license/client?format=junk", ""); err == nil || err.StatusCode != http.StatusBadRequest {
t.Fatal("should have errored with 400")
}
license, resp = th.SystemAdminClient.GetOldClientLicense("")
CheckNoError(t, resp)
if len(license["IsLicensed"]) == 0 {
t.Fatal("license not returned correctly")
}
}
func TestGetAudits(t *testing.T) {