diff --git a/ui/app/abilities/variable.js b/ui/app/abilities/variable.js index 6d392edb9..4f8e86351 100644 --- a/ui/app/abilities/variable.js +++ b/ui/app/abilities/variable.js @@ -48,7 +48,7 @@ export default class Variable extends AbstractAbility { @computed('token.selfTokenPolicies') get policiesSupportVariableList() { - return this.policyNamespacesIncludeSecureVariablesCapabilities( + return this.policyNamespacesIncludeVariablesCapabilities( this.token.selfTokenPolicies, ['list', 'read', 'write', 'destroy'] ); @@ -65,7 +65,7 @@ export default class Variable extends AbstractAbility { /** * * Map to your policy's namespaces, - * and each of their SecureVariables blocks' paths, + * and each of their Variables blocks' paths, * and each of their capabilities. * Then, check to see if any of the permissions you're looking for * are contained within at least one of them. @@ -74,36 +74,36 @@ export default class Variable extends AbstractAbility { * @param {string[]} capabilities * @returns {boolean} */ - policyNamespacesIncludeSecureVariablesCapabilities( + policyNamespacesIncludeVariablesCapabilities( policies = [], capabilities = [], path ) { - const namespacesWithSecureVariableCapabilities = policies + const namespacesWithVariableCapabilities = policies .toArray() .filter((policy) => get(policy, 'rulesJSON.Namespaces')) .map((policy) => get(policy, 'rulesJSON.Namespaces')) .flat() .map((namespace = {}) => { - return namespace.SecureVariables?.Paths; + return namespace.Variables?.Paths; }) .flat() .compact() - .filter((secVarsBlock = {}) => { + .filter((varsBlock = {}) => { if (!path || path === WILDCARD_GLOB) { return true; } else { - return secVarsBlock.PathSpec === path; + return varsBlock.PathSpec === path; } }) - .map((secVarsBlock = {}) => { - return secVarsBlock.Capabilities; + .map((varsBlock = {}) => { + return varsBlock.Capabilities; }) .flat() .compact(); // Check for requested permissions - return namespacesWithSecureVariableCapabilities.some((abilityList) => { + return namespacesWithVariableCapabilities.some((abilityList) => { return capabilities.includes(abilityList); }); } @@ -113,7 +113,7 @@ export default class Variable extends AbstractAbility { if (this.namespace === WILDCARD_GLOB && this.path === WILDCARD_GLOB) { // If you're checking if you can write from root, and you don't specify a namespace, // Then if you can write in ANY path in ANY namespace, you can get to /new. - return this.policyNamespacesIncludeSecureVariablesCapabilities( + return this.policyNamespacesIncludeVariablesCapabilities( this.token.selfTokenPolicies, ['write'], this._nearestMatchingPath(this.path) @@ -150,7 +150,7 @@ export default class Variable extends AbstractAbility { const variables = (namespaces || []).find( (namespace) => namespace.Name === matchingNamespace - )?.SecureVariables; + )?.Variables; const pathNames = variables?.Paths?.map((path) => ({ name: path.PathSpec, diff --git a/ui/app/components/secure-variable-form.hbs b/ui/app/components/variable-form.hbs similarity index 90% rename from ui/app/components/secure-variable-form.hbs rename to ui/app/components/variable-form.hbs index e50e9fe73..6bb2e1127 100644 --- a/ui/app/components/secure-variable-form.hbs +++ b/ui/app/components/variable-form.hbs @@ -1,17 +1,17 @@ {{did-update this.onViewChange @view}} {{did-insert this.establishKeyValues}} -
+ {{#if @model.isNew}} {{/if}} {{#if this.hasConflict}}
-

Heads up! Your Secure Variable has a conflict.

+

Heads up! Your variable has a conflict.

This might be because someone else tried saving in the time since you've had it open.

{{#if this.conflictingVariable.modifyTime}} @@ -46,7 +46,7 @@ /> {{#if this.duplicatePathWarning}}

- There is already a Secure Variable located at + There is already a variable located at {{this.path}} .
@@ -55,13 +55,13 @@ @route="variables.variable.edit" @model={{this.duplicatePathWarning.path}} > - edit the existing Secure Variable + edit the existing variable .

{{/if}} - - + {{#if (eq entry this.keyValues.lastObject)}} {{/if}} @@ -46,11 +46,11 @@
{{#if (eq this.namespaceSelection "*")}}

- No Secure Variables + No Variables

{{#if (can "write variable" path="*" namespace=this.namespaceSelection)}}

- Get started by creating a new secure variable + Get started by creating a new variable

{{/if}} {{else}} diff --git a/ui/app/templates/variables/new.hbs b/ui/app/templates/variables/new.hbs index c5c7efd19..ac52ecb4c 100644 --- a/ui/app/templates/variables/new.hbs +++ b/ui/app/templates/variables/new.hbs @@ -1,9 +1,9 @@ -{{page-title "New Secure Variable"}} +{{page-title "New Variable"}}

- Create a Secure Variable + Create a Variable JSON

- {{/each}} @@ -21,7 +21,7 @@ @query={{hash path=(concat this.absolutePath "/")}} class="button is-primary" > - Create Secure Variable + Create Variable {{else}} {{/if}}
@@ -50,7 +50,7 @@ Path /{{this.absolutePath}} contains no variables

- To get started, create a new secure variable here, or go back to the Secure Variables root directory. + To get started, create a new variable here, or go back to the Variables root directory.

{{else}}

diff --git a/ui/app/templates/variables/variable.hbs b/ui/app/templates/variables/variable.hbs index 7eea2143a..88ba26409 100644 --- a/ui/app/templates/variables/variable.hbs +++ b/ui/app/templates/variables/variable.hbs @@ -1,4 +1,4 @@ -{{page-title "Secure Variables: " this.model.path}} +{{page-title "Variables: " this.model.path}} {{#each this.breadcrumbs as |crumb|}} {{/each}} diff --git a/ui/app/templates/variables/variable/edit.hbs b/ui/app/templates/variables/variable/edit.hbs index 8ab737f18..3574d4f71 100644 --- a/ui/app/templates/variables/variable/edit.hbs +++ b/ui/app/templates/variables/variable/edit.hbs @@ -1,4 +1,4 @@ -{{page-title "Edit Secure Variable"}} +{{page-title "Edit Variable"}}

@@ -19,7 +19,7 @@

- {{#if this.shouldShowLinkedEntities}} - path.PathSpec === '*' ).Capabilities = ['list', 'read', 'destroy']; @@ -145,7 +145,7 @@ module('Acceptance | secure variables', function (hooks) { test('variables prefixed with nomad/jobs/ correctly link to entities', async function (assert) { assert.expect(23); allScenarios.variableTestCluster(server); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); const variableLinkedJob = server.db.jobs[0]; const variableLinkedGroup = server.db.taskGroups.findBy({ @@ -207,7 +207,7 @@ module('Acceptance | secure variables', function (hooks) { assert.dom(relatedEntitiesBox).exists('Related Entities box is present'); assert.ok( cleanWhitespace(relatedEntitiesBox.textContent).includes( - 'This secure variable is accessible by job' + 'This variable is accessible by job' ), 'Related Entities box is job-oriented' ); @@ -243,7 +243,7 @@ module('Acceptance | secure variables', function (hooks) { assert.dom(relatedEntitiesBox).exists('Related Entities box is present'); assert.ok( cleanWhitespace(relatedEntitiesBox.textContent).includes( - 'This secure variable is accessible by group' + 'This variable is accessible by group' ), 'Related Entities box is group-oriented' ); @@ -281,7 +281,7 @@ module('Acceptance | secure variables', function (hooks) { assert.dom(relatedEntitiesBox).exists('Related Entities box is present'); assert.ok( cleanWhitespace(relatedEntitiesBox.textContent).includes( - 'This secure variable is accessible by task' + 'This variable is accessible by task' ), 'Related Entities box is task-oriented' ); @@ -342,27 +342,25 @@ module('Acceptance | secure variables', function (hooks) { test('it passes an accessibility audit', async function (assert) { assert.expect(1); allScenarios.variableTestCluster(server); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; await Variables.visit(); await a11yAudit(assert); }); module('create flow', function () { - test('allows a user with correct permissions to create a secure variable', async function (assert) { + test('allows a user with correct permissions to create a variable', async function (assert) { // Arrange Test Set-up allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; await Variables.visit(); // End Test Set-up assert .dom('[data-test-create-var]') - .exists( - 'It should display an enabled button to create a secure variable' - ); + .exists('It should display an enabled button to create a variable'); await click('[data-test-create-var]'); assert.equal(currentRouteName(), 'variables.new'); @@ -402,14 +400,14 @@ module('Acceptance | secure variables', function (hooks) { window.localStorage.nomadTokenSecret = null; }); - test('prevents users from creating a secure variable without proper permissions', async function (assert) { + test('prevents users from creating a variable without proper permissions', async function (assert) { // Arrange Test Set-up allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; const policy = server.db.policies.find('Variable Maker'); - policy.rulesJSON.Namespaces[0].SecureVariables.Paths.find( + policy.rulesJSON.Namespaces[0].Variables.Paths.find( (path) => path.PathSpec === '*' ).Capabilities = ['list']; await Variables.visit(); @@ -418,7 +416,7 @@ module('Acceptance | secure variables', function (hooks) { assert .dom('[data-test-disabled-create-var]') .exists( - 'It should display an disabled button to create a secure variable on the main listings page' + 'It should display an disabled button to create a variable on the main listings page' ); // Reset Token @@ -429,7 +427,7 @@ module('Acceptance | secure variables', function (hooks) { // Arrange Test Set-up allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; await Variables.visitNew(); // End Test Set-up @@ -456,7 +454,7 @@ module('Acceptance | secure variables', function (hooks) { // Arrange Test Set-up allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; await Variables.visitNew(); // End Test Set-up @@ -476,15 +474,15 @@ module('Acceptance | secure variables', function (hooks) { }); module('edit flow', function () { - test('allows a user with correct permissions to edit a secure variable', async function (assert) { + test('allows a user with correct permissions to edit a variable', async function (assert) { assert.expect(8); // Arrange Test Set-up allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; const policy = server.db.policies.find('Variable Maker'); - policy.rulesJSON.Namespaces[0].SecureVariables.Paths.find( + policy.rulesJSON.Namespaces[0].Variables.Paths.find( (path) => path.PathSpec === '*' ).Capabilities = ['list', 'read', 'write']; server.db.variables.update({ namespace: 'default' }); @@ -531,14 +529,14 @@ module('Acceptance | secure variables', function (hooks) { window.localStorage.nomadTokenSecret = null; }); - test('prevents users from editing a secure variable without proper permissions', async function (assert) { + test('prevents users from editing a variable without proper permissions', async function (assert) { // Arrange Test Set-up allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; const policy = server.db.policies.find('Variable Maker'); - policy.rulesJSON.Namespaces[0].SecureVariables.Paths.find( + policy.rulesJSON.Namespaces[0].Variables.Paths.find( (path) => path.PathSpec === '*' ).Capabilities = ['list', 'read']; await Variables.visit(); @@ -556,7 +554,7 @@ module('Acceptance | secure variables', function (hooks) { test('handles conflicts on save', async function (assert) { // Arrange Test Set-up allScenarios.variableTestCluster(server); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; // End Test Set-up @@ -593,14 +591,14 @@ module('Acceptance | secure variables', function (hooks) { }); module('delete flow', function () { - test('allows a user with correct permissions to delete a secure variable', async function (assert) { + test('allows a user with correct permissions to delete a variable', async function (assert) { // Arrange Test Set-up allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; const policy = server.db.policies.find('Variable Maker'); - policy.rulesJSON.Namespaces[0].SecureVariables.Paths.find( + policy.rulesJSON.Namespaces[0].Variables.Paths.find( (path) => path.PathSpec === '*' ).Capabilities = ['list', 'read', 'destroy']; server.db.variables.update({ namespace: 'default' }); @@ -629,14 +627,14 @@ module('Acceptance | secure variables', function (hooks) { window.localStorage.nomadTokenSecret = null; }); - test('prevents users from delete a secure variable without proper permissions', async function (assert) { + test('prevents users from delete a variable without proper permissions', async function (assert) { // Arrange Test Set-up allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; const policy = server.db.policies.find('Variable Maker'); - policy.rulesJSON.Namespaces[0].SecureVariables.Paths.find( + policy.rulesJSON.Namespaces[0].Variables.Paths.find( (path) => path.PathSpec === '*' ).Capabilities = ['list', 'read']; await Variables.visit(); @@ -654,9 +652,9 @@ module('Acceptance | secure variables', function (hooks) { }); module('read flow', function () { - test('allows a user with correct permissions to read a secure variable', async function (assert) { + test('allows a user with correct permissions to read a variable', async function (assert) { allScenarios.variableTestCluster(server); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; await Variables.visit(); @@ -674,9 +672,9 @@ module('Acceptance | secure variables', function (hooks) { window.localStorage.nomadTokenSecret = null; }); - test('prevents users from reading a secure variable without proper permissions', async function (assert) { + test('prevents users from reading a variable without proper permissions', async function (assert) { allScenarios.variableTestCluster(server); - const variablesToken = server.db.tokens.find(LIMITED_SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(LIMITED_VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; await Variables.visit(); @@ -699,7 +697,7 @@ module('Acceptance | secure variables', function (hooks) { // Arrange allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; await Variables.visit(); @@ -731,7 +729,7 @@ module('Acceptance | secure variables', function (hooks) { test('does not show namespace filtering if the user only has access to one namespace', async function (assert) { allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; const twoTokens = server.db.namespaces.slice(0, 2); server.db.namespaces.remove(twoTokens); @@ -754,7 +752,7 @@ module('Acceptance | secure variables', function (hooks) { // Arrange allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; await Variables.visit(); await click('[data-test-folder-row]'); @@ -793,7 +791,7 @@ module('Acceptance | secure variables', function (hooks) { test('does not show namespace filtering if the user only has access to one namespace', async function (assert) { allScenarios.variableTestCluster(server); server.createList('variable', 3); - const variablesToken = server.db.tokens.find(SECURE_TOKEN_ID); + const variablesToken = server.db.tokens.find(VARIABLE_TOKEN_ID); window.localStorage.nomadTokenSecret = variablesToken.secretId; const twoTokens = server.db.namespaces.slice(0, 2); server.db.namespaces.remove(twoTokens); diff --git a/ui/tests/integration/components/secure-variable-form-test.js b/ui/tests/integration/components/variable-form-test.js similarity index 91% rename from ui/tests/integration/components/secure-variable-form-test.js rename to ui/tests/integration/components/variable-form-test.js index 43da21e7b..7ebe9af6d 100644 --- a/ui/tests/integration/components/secure-variable-form-test.js +++ b/ui/tests/integration/components/variable-form-test.js @@ -12,7 +12,7 @@ import { clickTrigger, } from 'ember-power-select/test-support/helpers'; -module('Integration | Component | secure-variable-form', function (hooks) { +module('Integration | Component | variable-form', function (hooks) { setupRenderingTest(hooks); setupMirage(hooks); setupCodeMirror(hooks); @@ -25,7 +25,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { keyValues: [{ key: '', value: '' }], }) ); - await render(hbs``); + await render(hbs``); await componentA11yAudit(this.element, assert); }); @@ -38,7 +38,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { ); assert.expect(7); - await render(hbs``); + await render(hbs``); assert.equal( findAll('div.key-value').length, 1, @@ -106,7 +106,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { assert.expect(6); - await render(hbs``); + await render(hbs``); await click('.key-value button.add-more'); // add a second variable findAll('input.value-input').forEach((input, iter) => { @@ -163,7 +163,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { keyValues, }) ); - await render(hbs``); + await render(hbs``); assert.equal( findAll('div.key-value').length, 5, @@ -206,7 +206,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { }); variable.isNew = false; this.set('variable', variable); - await render(hbs``); + await render(hbs``); assert.dom('input.path-input').hasValue('/baz/bat', 'Path is set'); assert .dom('input.path-input') @@ -215,7 +215,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { variable.isNew = true; variable.path = ''; this.set('variable', variable); - await render(hbs``); + await render(hbs``); assert .dom('input.path-input') .isNotDisabled('New variable is not in disabled state'); @@ -244,7 +244,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { this.set('existingVariables', server.db.variables.toArray()); await render( - hbs`` + hbs`` ); await typeIn('.path-input', 'foo/bar'); @@ -278,7 +278,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { }) ); - await render(hbs``); + await render(hbs``); await typeIn('.key-value label:nth-child(1) input', 'superSecret'); assert.dom('.key-value-error').doesNotExist(); @@ -297,7 +297,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { }) ); - await render(hbs``); + await render(hbs``); await click('.key-value button.add-more'); @@ -332,7 +332,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { this.set('view', 'table'); await render( - hbs`` + hbs`` ); assert.dom('.key-value').exists(); assert.dom('.CodeMirror').doesNotExist(); @@ -359,7 +359,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { this.set('view', 'json'); await render( - hbs`` + hbs`` ); await percySnapshot(assert); @@ -406,7 +406,7 @@ module('Integration | Component | secure-variable-form', function (hooks) { this.set('view', 'json'); await render( - hbs`` + hbs`` ); codeFillable('[data-test-json-editor]').get()( diff --git a/ui/tests/integration/components/variable-paths-test.js b/ui/tests/integration/components/variable-paths-test.js index 887ed3b52..74479e8da 100644 --- a/ui/tests/integration/components/variable-paths-test.js +++ b/ui/tests/integration/components/variable-paths-test.js @@ -89,7 +89,7 @@ module('Integration | Component | variable-paths', function (hooks) { { Name: '*', Capabilities: ['list-jobs', 'alloc-exec', 'read-logs'], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['list', 'read'], diff --git a/ui/tests/unit/abilities/abstract-test.js b/ui/tests/unit/abilities/abstract-test.js index 6afe50716..58d40073e 100644 --- a/ui/tests/unit/abilities/abstract-test.js +++ b/ui/tests/unit/abilities/abstract-test.js @@ -44,7 +44,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'default', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -88,7 +88,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: '*', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -128,7 +128,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'madness', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['read', 'list', 'write'], @@ -174,7 +174,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'default', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -218,7 +218,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: '*', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -258,7 +258,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'pablo', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['read', 'list', 'write'], @@ -304,7 +304,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'default', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -348,7 +348,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: '*', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -388,7 +388,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'pablo/*', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['read', 'list', 'write'], @@ -437,7 +437,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'default', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -481,7 +481,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: '*', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -521,7 +521,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: '*/rilkes', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['read', 'list', 'write'], @@ -570,7 +570,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'default', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write', 'read', 'destroy', 'list'], @@ -614,7 +614,7 @@ module('Unit | Ability | abstract', function (hooks) { ], Name: 'pablo/*', Policy: 'write', - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['read', 'list', 'write'], diff --git a/ui/tests/unit/abilities/variable-test.js b/ui/tests/unit/abilities/variable-test.js index 3434c00b6..b31e509c3 100644 --- a/ui/tests/unit/abilities/variable-test.js +++ b/ui/tests/unit/abilities/variable-test.js @@ -48,7 +48,7 @@ module('Unit | Ability | variable', function (hooks) { assert.ok(this.ability.canList); }); - test('it permits listing variables when token has SecureVariables with list capabilities in its rules', function (assert) { + test('it permits listing variables when token has Variables with list capabilities in its rules', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -59,7 +59,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['list'], PathSpec: '*' }], }, }, @@ -74,7 +74,7 @@ module('Unit | Ability | variable', function (hooks) { assert.ok(this.ability.canList); }); - test('it does not permit listing variables when token has SecureVariables alone in its rules', function (assert) { + test('it does not permit listing variables when token has Variables alone in its rules', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -85,7 +85,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: {}, + Variables: {}, }, ], }, @@ -98,7 +98,7 @@ module('Unit | Ability | variable', function (hooks) { assert.notOk(this.ability.canList); }); - test('it does not permit listing variables when token has a null SecureVariables block', function (assert) { + test('it does not permit listing variables when token has a null Variables block', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -109,7 +109,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: null, + Variables: null, }, ], }, @@ -122,7 +122,7 @@ module('Unit | Ability | variable', function (hooks) { assert.notOk(this.ability.canList); }); - test('it does not permit listing variables when token has a SecureVariables block where paths are without capabilities', function (assert) { + test('it does not permit listing variables when token has a Variables block where paths are without capabilities', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -133,7 +133,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [ { Capabilities: [], PathSpec: '*' }, { Capabilities: [], PathSpec: 'foo' }, @@ -152,7 +152,7 @@ module('Unit | Ability | variable', function (hooks) { assert.notOk(this.ability.canList); }); - test('it does not permit listing variables when token has no SecureVariables block', function (assert) { + test('it does not permit listing variables when token has no Variables block', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -175,7 +175,7 @@ module('Unit | Ability | variable', function (hooks) { assert.notOk(this.ability.canList); }); - test('it permits listing variables when token multiple namespaces, only one of which having a SecureVariables block', function (assert) { + test('it permits listing variables when token multiple namespaces, only one of which having a Variables block', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -186,19 +186,19 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: null, + Variables: null, }, { Name: 'nonsense', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: [], PathSpec: '*' }], }, }, { Name: 'shenanigans', Capabilities: [], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['list'], PathSpec: 'foo/bar/baz' }, ], @@ -249,7 +249,7 @@ module('Unit | Ability | variable', function (hooks) { assert.ok(this.ability.canWrite); }); - test('it permits creating variables when token has SecureVariables with write capabilities in its rules', function (assert) { + test('it permits creating variables when token has Variables with write capabilities in its rules', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -260,7 +260,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['write'], PathSpec: '*' }], }, }, @@ -286,14 +286,14 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['list'], PathSpec: 'foo/bar' }], }, }, { Name: 'pablo', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['write'], PathSpec: 'foo/bar' }], }, }, @@ -344,7 +344,7 @@ module('Unit | Ability | variable', function (hooks) { assert.ok(this.ability.canDestroy); }); - test('it permits destroying variables when token has SecureVariables with write capabilities in its rules', function (assert) { + test('it permits destroying variables when token has Variables with write capabilities in its rules', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -355,7 +355,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['destroy'], PathSpec: '*' }], }, }, @@ -381,14 +381,14 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['list'], PathSpec: 'foo/bar' }], }, }, { Name: 'pablo', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['destroy'], PathSpec: 'foo/bar' }], }, }, @@ -439,7 +439,7 @@ module('Unit | Ability | variable', function (hooks) { assert.ok(this.ability.canRead); }); - test('it permits reading variables when token has SecureVariables with read capabilities in its rules', function (assert) { + test('it permits reading variables when token has Variables with read capabilities in its rules', function (assert) { const mockToken = Service.extend({ aclEnabled: true, selfToken: { type: 'client' }, @@ -450,7 +450,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['read'], PathSpec: '*' }], }, }, @@ -476,14 +476,14 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['list'], PathSpec: 'foo/bar' }], }, }, { Name: 'pablo', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['read'], PathSpec: 'foo/bar' }], }, }, @@ -513,7 +513,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['write'], PathSpec: 'foo' }], }, }, @@ -546,7 +546,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write'], PathSpec: 'foo/*' }, { Capabilities: ['write'], PathSpec: 'foo/bar/*' }, @@ -582,7 +582,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['write'], PathSpec: 'foo/*' }], }, }, @@ -615,7 +615,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write'], PathSpec: '*/bar' }, { Capabilities: ['write'], PathSpec: '*/bar/baz' }, @@ -651,7 +651,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['write'], PathSpec: '*/bar' }, { Capabilities: ['write'], PathSpec: 'foo/*' }, @@ -687,7 +687,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { 'Path "*"': { Capabilities: ['write'], }, @@ -1082,14 +1082,14 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['write'], PathSpec: 'foo' }], }, }, { Name: 'bar', Capabilities: [], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['read', 'write'], PathSpec: 'foo' }, ], @@ -1129,14 +1129,14 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'default', Capabilities: [], - SecureVariables: { + Variables: { Paths: [{ Capabilities: ['write'], PathSpec: 'foo' }], }, }, { Name: 'bar', Capabilities: [], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['read', 'write'], PathSpec: 'foo' }, ], @@ -1176,7 +1176,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: '*', Capabilities: ['list-jobs', 'alloc-exec', 'read-logs'], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['list'], @@ -1188,7 +1188,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'namespace-1', Capabilities: ['list-jobs', 'alloc-exec', 'read-logs'], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['list', 'read', 'destroy', 'create'], @@ -1200,7 +1200,7 @@ module('Unit | Ability | variable', function (hooks) { { Name: 'namespace-2', Capabilities: ['list-jobs', 'alloc-exec', 'read-logs'], - SecureVariables: { + Variables: { Paths: [ { Capabilities: ['list', 'read', 'destroy', 'create'], diff --git a/ui/tests/unit/utils/path-tree-test.js b/ui/tests/unit/utils/path-tree-test.js index 1a51bf469..3060ae6b4 100644 --- a/ui/tests/unit/utils/path-tree-test.js +++ b/ui/tests/unit/utils/path-tree-test.js @@ -61,17 +61,17 @@ module('Unit | Utility | path-tree', function () { assert.equal( Object.keys(tree.findPath('a/b').files).length, 4, - 'Multiple files are listed at a found non-terminal compacted path with many secure variables' + 'Multiple files are listed at a found non-terminal compacted path with many variables' ); assert.equal( Object.keys(tree.findPath('a/b/c/doberman').files).length, 1, - 'One file listed at a found compacted path with a single secure variable' + 'One file listed at a found compacted path with a single variable' ); assert.equal( Object.keys(tree.findPath('a/b/c/dachshund').files).length, 2, - 'Multiple files listed at a found terminal compacted path with many secure variables' + 'Multiple files listed at a found terminal compacted path with many variables' ); }); });