From 0232570831ef6c2596542f58c2326a80460cffd3 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 20 Aug 2021 14:58:43 -0400 Subject: [PATCH 1/8] feature(capabilities): preliminary user create/list abilities --- addons/api/addon/models/base.js | 5 +++ addons/api/mirage/factories/scope.js | 13 +++++++ ui/admin/app/routes/scopes/scope/users.js | 8 +++-- .../app/routes/scopes/scope/users/index.js | 12 ++++++- ui/admin/app/templates/scopes/scope.hbs | 12 ++++--- .../templates/scopes/scope/users/index.hbs | 35 ++++++++++++++----- 6 files changed, 68 insertions(+), 17 deletions(-) diff --git a/addons/api/addon/models/base.js b/addons/api/addon/models/base.js index f99e0351a..7fd41ec64 100644 --- a/addons/api/addon/models/base.js +++ b/addons/api/addon/models/base.js @@ -42,6 +42,11 @@ export default class BaseModel extends Model { }) authorized_actions; + @attr({ + readOnly: true, + }) + authorized_collection_actions; + set scopeModel(model) { if (model) { const json = model.serialize(); diff --git a/addons/api/mirage/factories/scope.js b/addons/api/mirage/factories/scope.js index fe41f3866..4ac77e576 100644 --- a/addons/api/mirage/factories/scope.js +++ b/addons/api/mirage/factories/scope.js @@ -4,6 +4,19 @@ import { trait } from 'ember-cli-mirage'; export default factory.extend({ type: 'global', + authorized_collection_actions: () => { + return { + users: ['create', ''], + // groups: ['create', 'list'], + // roles: ['create', 'list'], + // 'auth-methods': ['create', 'list'], + // sessopms: ['list'], + // targets: ['create', 'list'], + // 'host-catalogs': ['create', 'list'], + // 'credential-stores': ['create', 'list'], + }; + }, + /** * Generates realistic-ish IDs while still being deterministic. */ diff --git a/ui/admin/app/routes/scopes/scope/users.js b/ui/admin/app/routes/scopes/scope/users.js index 42f9c8832..aa3dde96a 100644 --- a/ui/admin/app/routes/scopes/scope/users.js +++ b/ui/admin/app/routes/scopes/scope/users.js @@ -11,6 +11,7 @@ export default class ScopesScopeUsersRoute extends Route { @service intl; @service notify; @service session; + @service can; // =methods @@ -26,8 +27,11 @@ export default class ScopesScopeUsersRoute extends Route { * @return {Promise{[UserModel]}} */ async model() { - const { id: scope_id } = this.modelFor('scopes.scope'); - return this.store.query('user', { scope_id }); + const scope = this.modelFor('scopes.scope'); + const { id: scope_id } = scope; + if (this.can.can('list collection', scope, { collection: 'users' })) { + return this.store.query('user', { scope_id }); + } } // =actions diff --git a/ui/admin/app/routes/scopes/scope/users/index.js b/ui/admin/app/routes/scopes/scope/users/index.js index f59170106..8d3bc89c6 100644 --- a/ui/admin/app/routes/scopes/scope/users/index.js +++ b/ui/admin/app/routes/scopes/scope/users/index.js @@ -1,3 +1,13 @@ import Route from '@ember/routing/route'; -export default class ScopesScopeUsersIndexRoute extends Route {} +export default class ScopesScopeUsersIndexRoute extends Route { + + // =methods + + setupController(controller) { + const scope = this.modelFor('scopes.scope'); + super.setupController(...arguments); + controller.setProperties({ scope }); + } + +} diff --git a/ui/admin/app/templates/scopes/scope.hbs b/ui/admin/app/templates/scopes/scope.hbs index 65e456c51..825be5d14 100644 --- a/ui/admin/app/templates/scopes/scope.hbs +++ b/ui/admin/app/templates/scopes/scope.hbs @@ -94,10 +94,12 @@ {{#unless @model.isProject}} - - - {{t 'resources.user.title_plural'}} - + {{#if (can 'navigate collection' @model collection='users')}} + + + {{t 'resources.user.title_plural'}} + + {{/if}} {{t 'resources.group.title_plural'}} @@ -140,4 +142,4 @@ - \ No newline at end of file + diff --git a/ui/admin/app/templates/scopes/scope/users/index.hbs b/ui/admin/app/templates/scopes/scope/users/index.hbs index ab31bc1cf..61d80197b 100644 --- a/ui/admin/app/templates/scopes/scope/users/index.hbs +++ b/ui/admin/app/templates/scopes/scope/users/index.hbs @@ -15,10 +15,12 @@ - {{#if @model}} - {{t - 'titles.new' - }} + {{#if (can 'create collection' this.scope collection='users')}} + {{#if @model}} + {{t + 'titles.new' + }} + {{/if}} {{/if}} @@ -69,11 +71,26 @@ > {{t 'resources.user.description'}} + {{#if (can 'create collection' this.scope collection='users')}} + {{#unless (can 'list collection' this.scope collection='users')}} +
+
+ + Oh noes! Resources you create won't appear here because you + have create permission, but not list. + + {{/unless}} + {{/if}}
- - - {{t 'titles.new'}} - + {{#if (can 'create collection' this.scope collection='users')}} + + + {{t 'titles.new'}} + + {{/if}} @@ -81,4 +98,4 @@ - \ No newline at end of file + From f510d2f4fe43e84f6091f9ce9e7288d4dfe5784f Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 24 Aug 2021 14:46:21 -0400 Subject: [PATCH 2/8] chore: add create and list to mock user --- addons/api/mirage/factories/scope.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/api/mirage/factories/scope.js b/addons/api/mirage/factories/scope.js index 4ac77e576..e9c5ac09f 100644 --- a/addons/api/mirage/factories/scope.js +++ b/addons/api/mirage/factories/scope.js @@ -6,7 +6,7 @@ export default factory.extend({ authorized_collection_actions: () => { return { - users: ['create', ''], + users: ['create', 'list'], // groups: ['create', 'list'], // roles: ['create', 'list'], // 'auth-methods': ['create', 'list'], From 03e06a22a4c895eb9f55338aacbdba479297f234 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 24 Aug 2021 16:47:33 -0400 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20messages=20for?= =?UTF-8?q?=20insufficient=20permissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/abilities/collection.js | 3 +- addons/core/translations/en-us.yaml | 2 ++ .../app/routes/scopes/scope/users/index.js | 2 -- ui/admin/app/templates/scopes/scope.hbs | 2 +- .../templates/scopes/scope/users/index.hbs | 30 ++++++++++--------- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/addons/api/addon/abilities/collection.js b/addons/api/addon/abilities/collection.js index ad52afd18..92f0e4342 100644 --- a/addons/api/addon/abilities/collection.js +++ b/addons/api/addon/abilities/collection.js @@ -29,7 +29,8 @@ export default class CollectionAbility extends Ability { * @return {boolean} */ hasAuthorizedCollectionAction(action) { - const { authorized_collection_actions } = this.model; + const authorized_collection_actions = + (this.model || {}).authorized_collection_actions || {}; const collection = this.collection || {}; return authorized_collection_actions[collection]?.includes(action); } diff --git a/addons/core/translations/en-us.yaml b/addons/core/translations/en-us.yaml index 5370c7e75..8f98f633c 100644 --- a/addons/core/translations/en-us.yaml +++ b/addons/core/translations/en-us.yaml @@ -32,6 +32,8 @@ titles: descriptions: empty-set: There are no items to display yet. You may be able to add items or try back later. origin-initialization: To get started, please enter your origin URL + create-but-not-list: You do not have permission to list {resource}, but you can create new instances. + neither-list-nor-create: You do not have permission to list or create {resource}. questions: delete-confirm: Are you sure you want to delete this resource? remove-confirm: Are you sure you want to remove this association? diff --git a/ui/admin/app/routes/scopes/scope/users/index.js b/ui/admin/app/routes/scopes/scope/users/index.js index 8d3bc89c6..2e92b693d 100644 --- a/ui/admin/app/routes/scopes/scope/users/index.js +++ b/ui/admin/app/routes/scopes/scope/users/index.js @@ -1,7 +1,6 @@ import Route from '@ember/routing/route'; export default class ScopesScopeUsersIndexRoute extends Route { - // =methods setupController(controller) { @@ -9,5 +8,4 @@ export default class ScopesScopeUsersIndexRoute extends Route { super.setupController(...arguments); controller.setProperties({ scope }); } - } diff --git a/ui/admin/app/templates/scopes/scope.hbs b/ui/admin/app/templates/scopes/scope.hbs index 825be5d14..fd20ca2a2 100644 --- a/ui/admin/app/templates/scopes/scope.hbs +++ b/ui/admin/app/templates/scopes/scope.hbs @@ -142,4 +142,4 @@ - + \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/users/index.hbs b/ui/admin/app/templates/scopes/scope/users/index.hbs index 61d80197b..ef9ef91b3 100644 --- a/ui/admin/app/templates/scopes/scope/users/index.hbs +++ b/ui/admin/app/templates/scopes/scope/users/index.hbs @@ -70,19 +70,21 @@ as |message| > - {{t 'resources.user.description'}} - {{#if (can 'create collection' this.scope collection='users')}} - {{#unless (can 'list collection' this.scope collection='users')}} -
-
- - Oh noes! Resources you create won't appear here because you - have create permission, but not list. - - {{/unless}} + {{#if (can 'list collection' this.scope collection='users')}} + {{! can list (at least): show default welcome message}} + {{t 'resources.user.description'}} + {{else if (can 'create collection' this.scope collection='users')}} + {{! can create (only): show create-but-not-list welcome message}} + {{t + 'descriptions.create-but-not-list' + resource=(t 'resources.user.title_plural') + }} + {{else}} + {{! can neither list nor create }} + {{t + 'descriptions.neither-list-nor-create' + resource=(t 'resources.user.title_plural') + }} {{/if}}
{{#if (can 'create collection' this.scope collection='users')}} @@ -98,4 +100,4 @@ - + \ No newline at end of file From b0326e0c994c294a715701b1a6d17329a4f1813f Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 25 Aug 2021 16:24:26 -0400 Subject: [PATCH 4/8] test: add user create test and stubbed list test --- .../{users-test.js => users/create-test.js} | 22 ++++++- ui/admin/tests/acceptance/users/list-test.js | 57 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) rename ui/admin/tests/acceptance/{users-test.js => users/create-test.js} (74%) create mode 100644 ui/admin/tests/acceptance/users/list-test.js diff --git a/ui/admin/tests/acceptance/users-test.js b/ui/admin/tests/acceptance/users/create-test.js similarity index 74% rename from ui/admin/tests/acceptance/users-test.js rename to ui/admin/tests/acceptance/users/create-test.js index b047a0d2a..069ca0102 100644 --- a/ui/admin/tests/acceptance/users-test.js +++ b/ui/admin/tests/acceptance/users/create-test.js @@ -10,23 +10,28 @@ import { //invalidateSession, } from 'ember-simple-auth/test-support'; -module('Acceptance | users', function (hooks) { +module('Acceptance | users | create', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); + let globalScope; let orgScope; + let orgURL; let usersURL; let newUserURL; hooks.beforeEach(function () { + globalScope = this.server.create('scope', { id: 'global' }); orgScope = this.server.create( 'scope', { type: 'org', + scope: { id: 'global', type: 'global' }, }, 'withChildren' ); + orgURL = `/scopes/${orgScope.id}`; usersURL = `/scopes/${orgScope.id}/users`; newUserURL = `${usersURL}/new`; @@ -42,6 +47,21 @@ module('Acceptance | users', function (hooks) { assert.equal(this.server.db.users.length, usersCount + 1); }); + test('can navigate to new users route with proper authorization', async function (assert) { + assert.expect(2); + await visit(orgURL); + assert.ok(orgScope.authorized_collection_actions.users.includes('create')); + assert.ok(find(`[href="${orgURL}/users"]`)); + }); + + test('cannot navigate to new users route without proper authorization', async function (assert) { + assert.expect(2); + orgScope.authorized_collection_actions.users = []; + await visit(orgURL); + assert.notOk(orgScope.authorized_collection_actions.users.includes('create')); + assert.notOk(find(`[href="${orgURL}/users"]`)); + }); + test('can cancel creation of a new user', async function (assert) { assert.expect(2); const usersCount = this.server.db.users.length; diff --git a/ui/admin/tests/acceptance/users/list-test.js b/ui/admin/tests/acceptance/users/list-test.js new file mode 100644 index 000000000..bf768b334 --- /dev/null +++ b/ui/admin/tests/acceptance/users/list-test.js @@ -0,0 +1,57 @@ +import { module, test } from 'qunit'; +import { visit, currentURL, find } from '@ember/test-helpers'; +import { setupApplicationTest } from 'ember-qunit'; +import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; +import a11yAudit from 'ember-a11y-testing/test-support/audit'; +import { + authenticateSession, + // These are left here intentionally for future reference. + //currentSession, + //invalidateSession, +} from 'ember-simple-auth/test-support'; + +module('Acceptance | users | list', function (hooks) { + setupApplicationTest(hooks); + setupMirage(hooks); + + let usersURL; + + const instances = { + scopes: { + global: null, + org: null, + } + }; + + const urls = { + scopes: { + org: null + }, + users: null + }; + + hooks.beforeEach(function () { + instances.scopes.global = this.server.create('scope', { id: 'global' }); + instances.org = this.server.create( + 'scope', + { + type: 'org', + scope: { id: 'global', type: 'global' }, + }, + 'withChildren' + ); + instances.user = this.server.create('user', { + scope: instances.org, + }); + urls.users = `/scopes/${instances.org.id}/users`; + authenticateSession({}); + }); + + test('can navigate to users with proper authorization', async function (assert) { + // TODO + }); + + test('cannot navigate to users with proper authorization', async function (assert) { + // TODO + }); +}); From b5fdb850f6a14f7077439cdb35684144eae9917d Mon Sep 17 00:00:00 2001 From: dharini Date: Thu, 26 Aug 2021 00:02:57 -0700 Subject: [PATCH 5/8] =?UTF-8?q?test:=20=F0=9F=92=8D=20add=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/acceptance/users/create-test.js | 6 ++-- ui/admin/tests/acceptance/users/list-test.js | 36 ++++++++++++++----- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/ui/admin/tests/acceptance/users/create-test.js b/ui/admin/tests/acceptance/users/create-test.js index 069ca0102..fbff7fbee 100644 --- a/ui/admin/tests/acceptance/users/create-test.js +++ b/ui/admin/tests/acceptance/users/create-test.js @@ -14,14 +14,12 @@ module('Acceptance | users | create', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - let globalScope; let orgScope; let orgURL; let usersURL; let newUserURL; hooks.beforeEach(function () { - globalScope = this.server.create('scope', { id: 'global' }); orgScope = this.server.create( 'scope', { @@ -58,7 +56,9 @@ module('Acceptance | users | create', function (hooks) { assert.expect(2); orgScope.authorized_collection_actions.users = []; await visit(orgURL); - assert.notOk(orgScope.authorized_collection_actions.users.includes('create')); + assert.notOk( + orgScope.authorized_collection_actions.users.includes('create') + ); assert.notOk(find(`[href="${orgURL}/users"]`)); }); diff --git a/ui/admin/tests/acceptance/users/list-test.js b/ui/admin/tests/acceptance/users/list-test.js index bf768b334..8e071febc 100644 --- a/ui/admin/tests/acceptance/users/list-test.js +++ b/ui/admin/tests/acceptance/users/list-test.js @@ -1,8 +1,7 @@ import { module, test } from 'qunit'; -import { visit, currentURL, find } from '@ember/test-helpers'; +import { visit, find } from '@ember/test-helpers'; import { setupApplicationTest } from 'ember-qunit'; import setupMirage from 'ember-cli-mirage/test-support/setup-mirage'; -import a11yAudit from 'ember-a11y-testing/test-support/audit'; import { authenticateSession, // These are left here intentionally for future reference. @@ -13,25 +12,33 @@ import { module('Acceptance | users | list', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - - let usersURL; + let orgScope; + let orgURL; const instances = { scopes: { global: null, org: null, - } + }, }; const urls = { scopes: { - org: null + org: null, }, - users: null + users: null, }; hooks.beforeEach(function () { instances.scopes.global = this.server.create('scope', { id: 'global' }); + orgScope = this.server.create( + 'scope', + { + type: 'org', + scope: { id: 'global', type: 'global' }, + }, + 'withChildren' + ); instances.org = this.server.create( 'scope', { @@ -43,15 +50,26 @@ module('Acceptance | users | list', function (hooks) { instances.user = this.server.create('user', { scope: instances.org, }); + orgURL = `/scopes/${orgScope.id}`; + urls.users = `/scopes/${instances.org.id}/users`; authenticateSession({}); }); test('can navigate to users with proper authorization', async function (assert) { - // TODO + assert.expect(2); + await visit(orgURL); + assert.ok(orgScope.authorized_collection_actions.users.includes('create')); + assert.ok(find(`[href="${orgURL}/users"]`)); }); test('cannot navigate to users with proper authorization', async function (assert) { - // TODO + assert.expect(2); + orgScope.authorized_collection_actions.users = []; + await visit(orgURL); + assert.notOk( + orgScope.authorized_collection_actions.users.includes('create') + ); + assert.notOk(find(`[href="${orgURL}/users"]`)); }); }); From 350c4f5f70e2e4b67ee7df42506ce722557e1d56 Mon Sep 17 00:00:00 2001 From: dharini Date: Fri, 27 Aug 2021 08:06:24 -0700 Subject: [PATCH 6/8] =?UTF-8?q?fix:=20=F0=9F=90=9B=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/tests/acceptance/users/list-test.js | 30 +++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/ui/admin/tests/acceptance/users/list-test.js b/ui/admin/tests/acceptance/users/list-test.js index 8e071febc..0d8aaa60e 100644 --- a/ui/admin/tests/acceptance/users/list-test.js +++ b/ui/admin/tests/acceptance/users/list-test.js @@ -12,7 +12,6 @@ import { module('Acceptance | users | list', function (hooks) { setupApplicationTest(hooks); setupMirage(hooks); - let orgScope; let orgURL; const instances = { @@ -27,11 +26,12 @@ module('Acceptance | users | list', function (hooks) { org: null, }, users: null, + orgScope: null, }; hooks.beforeEach(function () { instances.scopes.global = this.server.create('scope', { id: 'global' }); - orgScope = this.server.create( + urls.orgScope = this.server.create( 'scope', { type: 'org', @@ -50,26 +50,36 @@ module('Acceptance | users | list', function (hooks) { instances.user = this.server.create('user', { scope: instances.org, }); - orgURL = `/scopes/${orgScope.id}`; + orgURL = `/scopes/${urls.orgScope.id}`; + //urls.orgScope = `/scopes/${instances.org.id}/scopes`; - urls.users = `/scopes/${instances.org.id}/users`; + urls.users = `/scopes/${urls.orgScope.id}/users`; authenticateSession({}); }); test('can navigate to users with proper authorization', async function (assert) { assert.expect(2); await visit(orgURL); - assert.ok(orgScope.authorized_collection_actions.users.includes('create')); - assert.ok(find(`[href="${orgURL}/users"]`)); + assert.ok( + urls.orgScope.authorized_collection_actions.users.includes('list') + ); + assert.ok(find(`[href="${urls.users}"]`)); }); - test('cannot navigate to users with proper authorization', async function (assert) { + test('User cannot navigate to index without either list or create actions', async function (assert) { assert.expect(2); - orgScope.authorized_collection_actions.users = []; + urls.orgScope.authorized_collection_actions.users = []; await visit(orgURL); assert.notOk( - orgScope.authorized_collection_actions.users.includes('create') + urls.orgScope.authorized_collection_actions.users.includes('list') ); - assert.notOk(find(`[href="${orgURL}/users"]`)); + assert.notOk(find(`[href="${urls.usersorgURL}"]`)); + }); + + test('User can navigate to index with only create action', async function (assert) { + assert.expect(1); + urls.orgScope.authorized_collection_actions.users = ['create']; + await visit(orgURL); + assert.ok(find(`[href="${urls.users}"]`)); }); }); From 40c2acd6ab476c3b5863d5cafe76c06d174c3318 Mon Sep 17 00:00:00 2001 From: Dharini Jeeva Date: Fri, 27 Aug 2021 10:17:34 -0700 Subject: [PATCH 7/8] Update list-test.js --- ui/admin/tests/acceptance/users/list-test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/ui/admin/tests/acceptance/users/list-test.js b/ui/admin/tests/acceptance/users/list-test.js index 0d8aaa60e..d752d8687 100644 --- a/ui/admin/tests/acceptance/users/list-test.js +++ b/ui/admin/tests/acceptance/users/list-test.js @@ -51,8 +51,6 @@ module('Acceptance | users | list', function (hooks) { scope: instances.org, }); orgURL = `/scopes/${urls.orgScope.id}`; - //urls.orgScope = `/scopes/${instances.org.id}/scopes`; - urls.users = `/scopes/${urls.orgScope.id}/users`; authenticateSession({}); }); From ce286964d11a85d3d1305de598a6a65e28a2e04c Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 30 Aug 2021 21:49:48 -0700 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=F0=9F=90=9B=20tests=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/tests/acceptance/users/list-test.js | 28 +++++++------------- 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/ui/admin/tests/acceptance/users/list-test.js b/ui/admin/tests/acceptance/users/list-test.js index d752d8687..72a6e35eb 100644 --- a/ui/admin/tests/acceptance/users/list-test.js +++ b/ui/admin/tests/acceptance/users/list-test.js @@ -19,6 +19,7 @@ module('Acceptance | users | list', function (hooks) { global: null, org: null, }, + orgScope: null, }; const urls = { @@ -26,20 +27,11 @@ module('Acceptance | users | list', function (hooks) { org: null, }, users: null, - orgScope: null, }; hooks.beforeEach(function () { instances.scopes.global = this.server.create('scope', { id: 'global' }); - urls.orgScope = this.server.create( - 'scope', - { - type: 'org', - scope: { id: 'global', type: 'global' }, - }, - 'withChildren' - ); - instances.org = this.server.create( + instances.orgScope = this.server.create( 'scope', { type: 'org', @@ -48,10 +40,10 @@ module('Acceptance | users | list', function (hooks) { 'withChildren' ); instances.user = this.server.create('user', { - scope: instances.org, + scope: instances.orgScope, }); - orgURL = `/scopes/${urls.orgScope.id}`; - urls.users = `/scopes/${urls.orgScope.id}/users`; + orgURL = `/scopes/${instances.orgScope.id}`; + urls.users = `/scopes/${instances.orgScope.id}/users`; authenticateSession({}); }); @@ -59,24 +51,24 @@ module('Acceptance | users | list', function (hooks) { assert.expect(2); await visit(orgURL); assert.ok( - urls.orgScope.authorized_collection_actions.users.includes('list') + instances.orgScope.authorized_collection_actions.users.includes('list') ); assert.ok(find(`[href="${urls.users}"]`)); }); test('User cannot navigate to index without either list or create actions', async function (assert) { assert.expect(2); - urls.orgScope.authorized_collection_actions.users = []; + instances.orgScope.authorized_collection_actions.users = []; await visit(orgURL); assert.notOk( - urls.orgScope.authorized_collection_actions.users.includes('list') + instances.orgScope.authorized_collection_actions.users.includes('list') ); - assert.notOk(find(`[href="${urls.usersorgURL}"]`)); + assert.notOk(find(`[href="${urls.users}"]`)); }); test('User can navigate to index with only create action', async function (assert) { assert.expect(1); - urls.orgScope.authorized_collection_actions.users = ['create']; + instances.orgScope.authorized_collection_actions.users = ['create']; await visit(orgURL); assert.ok(find(`[href="${urls.users}"]`)); });