don't check capabilities before rendering the credentials route (#4446)

This commit is contained in:
Matthew Irish 2018-04-24 22:22:18 -05:00 committed by GitHub
parent e29bf3df61
commit 8d820fd02e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 20 deletions

View File

@ -10,14 +10,6 @@ export default Ember.Route.extend(UnloadModel, {
return this.modelFor('vault.cluster.secrets.backend');
},
pathQuery(role, backend) {
const type = this.backendModel().get('type');
if (type === 'pki') {
return `${backend}/issue/${role}`;
}
return `${backend}/creds/${role}`;
},
model(params) {
const role = params.secret;
const backendModel = this.backendModel();
@ -26,18 +18,11 @@ export default Ember.Route.extend(UnloadModel, {
if (!SUPPORTED_DYNAMIC_BACKENDS.includes(backendModel.get('type'))) {
return this.transitionTo('vault.cluster.secrets.backend.list-root', backend);
}
return this.store
.queryRecord('capabilities', { id: this.pathQuery(role, backend) })
.then(capabilities => {
if (!capabilities.get('canUpdate')) {
return this.transitionTo('vault.cluster.secrets.backend.list-root', backend);
}
return Ember.RSVP.resolve({
backend,
id: role,
name: role,
});
});
return Ember.RSVP.resolve({
backend,
id: role,
name: role,
});
},
setupController(controller) {