Skip to content

Commit

Permalink
implement feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andaley committed Jan 28, 2019
1 parent 9dea50d commit d85c709
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 7 additions & 3 deletions ui/app/components/wizard/features-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ export default Component.extend({
},

doesNotHavePermission(requiredPermissions) {
// requiredPermissions is an object of paths and capabilities defined within allFeatures.
// the expected shape is:
// {
// 'example/path': ['capability'],
// 'second/example/path': ['update', 'sudo'],
// }
return !Object.keys(requiredPermissions).every(path => {
return requiredPermissions[path].every(capability => {
return this.permissions.hasPermission(path, [capability]);
});
return this.permissions.hasPermission(path, requiredPermissions[path]);
});
},

Expand Down
5 changes: 0 additions & 5 deletions ui/tests/integration/components/features-selection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ module('Integration | Component | features-selection', function(hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function() {
component.setContext(this);
this.owner.register('service:permissions', permissionsService);
});

hooks.afterEach(function() {
component.removeContext();
});

test('it disables and enables wizard items according to user permissions', async function(assert) {
const enabled = { Secrets: true, Authentication: true, Policies: false, Tools: false };
await render(hbs`{{wizard/features-selection}}`);
Expand Down

0 comments on commit d85c709

Please sign in to comment.