d1b3a63b2f
In some circumstances a consul 1.4 client could be running in an un-upgraded 1.3 or lower cluster. Currently this gives a 500 error on the new ACL token endpoint. Here we catch this specific 500 error/message and set the users AccessorID to null. Elsewhere in the frontend we use this fact (AccessorID being null) to decide whether to present the legacy or the new ACL UI to the user. Also: - Re-adds in most of the old style ACL acceptance tests, now that we are keeping the old style UI - Restricts code editors to HCL only mode for all `Rules` editing (legacy/'half legacy'/new style) - Adds a [Stop using] button to the old style ACL rows so its possible to logout. - Updates copy and documentation links for the upgrade notices
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import Route from '@ember/routing/route';
|
|
import { get } from '@ember/object';
|
|
import { inject as service } from '@ember/service';
|
|
import WithBlockingActions from 'consul-ui/mixins/with-blocking-actions';
|
|
export default Route.extend(WithBlockingActions, {
|
|
settings: service('settings'),
|
|
feedback: service('feedback'),
|
|
repo: service('repository/token'),
|
|
actions: {
|
|
authorize: function(secret) {
|
|
const dc = this.modelFor('dc').dc.Name;
|
|
return get(this, 'feedback').execute(() => {
|
|
return get(this, 'repo')
|
|
.self(secret, dc)
|
|
.then(item => {
|
|
get(this, 'settings')
|
|
.persist({
|
|
token: {
|
|
AccessorID: get(item, 'AccessorID'),
|
|
SecretID: secret,
|
|
},
|
|
})
|
|
.then(item => {
|
|
// a null AccessorID means we are in legacy mode
|
|
// take the user to the legacy acls
|
|
// otherwise just refresh the page
|
|
if (get(item, 'token.AccessorID') === null) {
|
|
return this.transitionTo('dc.acls');
|
|
} else {
|
|
this.refresh();
|
|
}
|
|
});
|
|
});
|
|
}, 'authorize');
|
|
},
|
|
},
|
|
});
|