Reapply ember-can upgrade (#3111)
* chore: 🤖 reapply previous ember-can upgrade from #3093 * chore: 🤖 add missing ember-inflector dependency * chore: 🤖 move @ember/string to be a dependency in desktop * chore: 🤖 re-run pnpm install to resolve lockfile dupe key error * chore: 🤖 remove unused abilities service injections Co-Authored-By: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com> --------- Co-authored-by: Lisbet Alvarez <107949262+lisbet-alvarez@users.noreply.github.com>
This commit is contained in:
1 parent
772857dbad
commit
3a847605ed
108 files changed
+533
-454
No files matched your search
@@ -14,11 +14,11 @@ import {
|
||||
module('Unit | Abilities | Auth Method', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let canService;
|
||||
let abilitiesService;
|
||||
let store;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
canService = this.owner.lookup('service:can');
|
||||
abilitiesService = this.owner.lookup('service:abilities');
|
||||
store = this.owner.lookup('service:store');
|
||||
});
|
||||
|
||||
@@ -27,13 +27,13 @@ module('Unit | Abilities | Auth Method', function (hooks) {
|
||||
authorized_actions: ['read'],
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
assert.true(canService.can('read auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('read auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.true(canService.can('read auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('read auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.true(canService.can('read auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('read auth-method', authMethod));
|
||||
authMethod.type = 'no-such-type';
|
||||
assert.false(canService.can('read auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('read auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('cannot read auth methods when unauthorized', function (assert) {
|
||||
@@ -41,13 +41,13 @@ module('Unit | Abilities | Auth Method', function (hooks) {
|
||||
authorized_actions: [],
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
assert.false(canService.can('read auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('read auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.false(canService.can('read auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('read auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.false(canService.can('read auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('read auth-method', authMethod));
|
||||
authMethod.type = 'no-such-type';
|
||||
assert.false(canService.can('read auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('read auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('can delete known auth method types when authorized', function (assert) {
|
||||
@@ -55,13 +55,13 @@ module('Unit | Abilities | Auth Method', function (hooks) {
|
||||
authorized_actions: ['delete'],
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
assert.true(canService.can('delete auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('delete auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.true(canService.can('delete auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('delete auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.true(canService.can('delete auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('delete auth-method', authMethod));
|
||||
authMethod.type = 'no-such-type';
|
||||
assert.false(canService.can('delete auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('delete auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('cannot delete auth methods when unauthorized', function (assert) {
|
||||
@@ -69,13 +69,13 @@ module('Unit | Abilities | Auth Method', function (hooks) {
|
||||
authorized_actions: ['delete'],
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
assert.true(canService.can('delete auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('delete auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.true(canService.can('delete auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('delete auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.true(canService.can('delete auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('delete auth-method', authMethod));
|
||||
authMethod.type = 'no-such-type';
|
||||
assert.false(canService.can('delete auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('delete auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('can update known auth method types when authorized', function (assert) {
|
||||
@@ -83,13 +83,13 @@ module('Unit | Abilities | Auth Method', function (hooks) {
|
||||
authorized_actions: ['update'],
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
assert.true(canService.can('update auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('update auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.true(canService.can('update auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('update auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.true(canService.can('update auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('update auth-method', authMethod));
|
||||
authMethod.type = 'no-such-type';
|
||||
assert.false(canService.can('update auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('update auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('cannot update auth methods when unauthorized', function (assert) {
|
||||
@@ -97,12 +97,12 @@ module('Unit | Abilities | Auth Method', function (hooks) {
|
||||
authorized_actions: [],
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
assert.false(canService.can('update auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('update auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.false(canService.can('update auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('update auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.false(canService.can('update auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('update auth-method', authMethod));
|
||||
authMethod.type = 'no-such-type';
|
||||
assert.false(canService.can('update auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('update auth-method', authMethod));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user