open-vault/ui/app/routes/vault/cluster/logout.js
Noelle Daley 58dfd8aa68
Add Policy-based Navigation (#5967)
* add permissions service

* start template helper

* match prefixed paths

* gate sidebar links

* land on first page user has access to

* show nav when user first logs in

* clear paths when user logs out

* add tests

* implement feedback

* show all nav items if no policy is found

* update onboarding wizard

* fix some unrelated tests

* add support for namespaces

* gate wizard

* unstage package and lockfile
2019-01-18 14:04:40 -08:00

28 lines
813 B
JavaScript

import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import ModelBoundaryRoute from 'vault/mixins/model-boundary-route';
export default Route.extend(ModelBoundaryRoute, {
auth: service(),
controlGroup: service(),
flashMessages: service(),
console: service(),
permissions: service(),
modelTypes: computed(function() {
return ['secret', 'secret-engine'];
}),
beforeModel() {
this.get('auth').deleteCurrentToken();
this.get('controlGroup').deleteTokens();
this.get('console').set('isOpen', false);
this.get('console').clearLog(true);
this.clearModelCache();
this.replaceWith('vault.cluster');
this.get('flashMessages').clearMessages();
this.get('permissions').reset();
},
});