mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-07 14:08:42 +00:00
* add replicationRedacted attribute to cluster model * disallow access to replication pages if repl endpoints are redacted * hide replicatio nav item * Hide replication card on dashboard
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { inject as service } from '@ember/service';
|
|
import { setProperties } from '@ember/object';
|
|
import { hash } from 'rsvp';
|
|
import Route from '@ember/routing/route';
|
|
import ClusterRoute from 'vault/mixins/cluster-route';
|
|
|
|
export default Route.extend(ClusterRoute, {
|
|
version: service(),
|
|
store: service(),
|
|
auth: service(),
|
|
router: service(),
|
|
|
|
beforeModel() {
|
|
if (this.auth.activeCluster.replicationRedacted) {
|
|
// disallow replication access if endpoints are redacted
|
|
return this.router.transitionTo('vault.cluster');
|
|
}
|
|
return this.version.fetchFeatures().then(() => {
|
|
return this._super(...arguments);
|
|
});
|
|
},
|
|
|
|
model() {
|
|
return this.auth.activeCluster;
|
|
},
|
|
|
|
afterModel(model) {
|
|
return hash({
|
|
canEnablePrimary: this.store
|
|
.findRecord('capabilities', 'sys/replication/primary/enable')
|
|
.then((c) => c.get('canUpdate')),
|
|
canEnableSecondary: this.store
|
|
.findRecord('capabilities', 'sys/replication/secondary/enable')
|
|
.then((c) => c.get('canUpdate')),
|
|
}).then(({ canEnablePrimary, canEnableSecondary }) => {
|
|
setProperties(model, {
|
|
canEnablePrimary,
|
|
canEnableSecondary,
|
|
});
|
|
return model;
|
|
});
|
|
},
|
|
actions: {
|
|
refresh() {
|
|
this.refresh();
|
|
},
|
|
},
|
|
});
|