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
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
9a87bb3af6
Коммит
5a60ea0d75
@@ -231,6 +231,14 @@ func getClientLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
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.Header().Set(model.HEADER_ETAG_SERVER, etag)
|
||||||
w.Write([]byte(model.MapToJson(utils.GetSanitizedClientLicense())))
|
w.Write([]byte(model.MapToJson(clientLicense)))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,6 +180,13 @@ func TestGetOldClientLicense(t *testing.T) {
|
|||||||
if _, err := Client.DoApiGet("/license/client?format=junk", ""); err == nil || err.StatusCode != http.StatusBadRequest {
|
if _, err := Client.DoApiGet("/license/client?format=junk", ""); err == nil || err.StatusCode != http.StatusBadRequest {
|
||||||
t.Fatal("should have errored with 400")
|
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) {
|
func TestGetAudits(t *testing.T) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import $ from 'jquery';
|
|||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
|
|
||||||
|
import ErrorStore from 'stores/error_store.jsx';
|
||||||
import {uploadLicenseFile, removeLicenseFile} from 'actions/admin_actions.jsx';
|
import {uploadLicenseFile, removeLicenseFile} from 'actions/admin_actions.jsx';
|
||||||
|
|
||||||
import {injectIntl, intlShape, defineMessages, FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
import {injectIntl, intlShape, defineMessages, FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
||||||
@@ -80,6 +81,7 @@ class LicenseSettings extends React.Component {
|
|||||||
() => {
|
() => {
|
||||||
$('#remove-button').button('reset');
|
$('#remove-button').button('reset');
|
||||||
this.setState({fileSelected: false, fileName: null, serverError: null});
|
this.setState({fileSelected: false, fileName: null, serverError: null});
|
||||||
|
ErrorStore.clearLastError(true);
|
||||||
window.location.reload(true);
|
window.location.reload(true);
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user