Skip to content

Commit

Permalink
don't check capabilities before rendering the credentials route (#4446)
Browse files Browse the repository at this point in the history
  • Loading branch information
meirish authored Apr 25, 2018
1 parent 820fea5 commit 5bf6e8b
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions ui/app/routes/vault/cluster/secrets/backend/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down

0 comments on commit 5bf6e8b

Please sign in to comment.