chore: 🤖 bump ember-can (#3093)
* chore: 🤖 bump ember-can * chore: 🤖 rename "can" service (deprecated) to abilities See https://github.com/minutebase/ember-can/pull/152 * chore: 🤖 bump to ember-can@^8 * chore: 🤖 extend resolver for ember-can v7 breaking change https://github.com/minutebase/ember-can/pull/186
This commit is contained in:
1 parent
29fb5b00cb
commit
b5d33948dc
107 files changed
+542
-435
No files matched your search
@@ -14,7 +14,7 @@ import {
|
||||
module('Unit | Abilities | User', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let canService;
|
||||
let abilitiesService;
|
||||
let store;
|
||||
|
||||
const instances = {
|
||||
@@ -23,7 +23,7 @@ module('Unit | Abilities | User', function (hooks) {
|
||||
};
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
canService = this.owner.lookup('service:can');
|
||||
abilitiesService = this.owner.lookup('service:abilities');
|
||||
store = this.owner.lookup('service:store');
|
||||
instances.user = store.createRecord('user');
|
||||
instances.account = store.createRecord('account');
|
||||
@@ -31,28 +31,28 @@ module('Unit | Abilities | User', function (hooks) {
|
||||
|
||||
test('can add accounts to user when authorized and given a known account type', function (assert) {
|
||||
instances.user.authorized_actions = ['add-accounts'];
|
||||
assert.true(canService.can('addAccounts user', instances.user));
|
||||
assert.true(abilitiesService.can('addAccounts user', instances.user));
|
||||
instances.account.type = TYPE_AUTH_METHOD_OIDC;
|
||||
assert.true(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.true(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.true(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = 'no-such-type';
|
||||
assert.false(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
@@ -60,28 +60,28 @@ module('Unit | Abilities | User', function (hooks) {
|
||||
|
||||
test('cannot add accounts to user when unauthorized', function (assert) {
|
||||
instances.user.authorized_actions = [];
|
||||
assert.false(canService.can('addAccounts user', instances.user));
|
||||
assert.false(abilitiesService.can('addAccounts user', instances.user));
|
||||
instances.account.type = TYPE_AUTH_METHOD_OIDC;
|
||||
assert.false(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.false(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.false(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = 'no-such-type';
|
||||
assert.false(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
@@ -89,28 +89,28 @@ module('Unit | Abilities | User', function (hooks) {
|
||||
|
||||
test('can remove accounts from user when authorized and given a known account type', function (assert) {
|
||||
instances.user.authorized_actions = ['remove-accounts'];
|
||||
assert.true(canService.can('removeAccounts user', instances.user));
|
||||
assert.true(abilitiesService.can('removeAccounts user', instances.user));
|
||||
instances.account.type = TYPE_AUTH_METHOD_OIDC;
|
||||
assert.true(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.true(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.true(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = 'no-such-type';
|
||||
assert.false(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
@@ -118,28 +118,28 @@ module('Unit | Abilities | User', function (hooks) {
|
||||
|
||||
test('cannot remove accounts from user when unauthorized', function (assert) {
|
||||
instances.user.authorized_actions = [];
|
||||
assert.false(canService.can('removeAccounts user', instances.user));
|
||||
assert.false(abilitiesService.can('removeAccounts user', instances.user));
|
||||
instances.account.type = TYPE_AUTH_METHOD_OIDC;
|
||||
assert.false(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.false(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.false(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
instances.account.type = 'no-such-type';
|
||||
assert.false(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user