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,12 +14,12 @@ import {
|
||||
module('Unit | Abilities | auth-method', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let canService;
|
||||
let abilitiesService;
|
||||
let store;
|
||||
let features;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
canService = this.owner.lookup('service:can');
|
||||
abilitiesService = this.owner.lookup('service:abilities');
|
||||
store = this.owner.lookup('service:store');
|
||||
features = this.owner.lookup('service:features');
|
||||
});
|
||||
@@ -30,9 +30,9 @@ module('Unit | Abilities | auth-method', function (hooks) {
|
||||
authorized_actions: ['read'],
|
||||
type: TYPE_AUTH_METHOD_LDAP,
|
||||
});
|
||||
assert.true(canService.can('read auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('read auth-method', authMethod));
|
||||
authMethod.authorized_actions = [];
|
||||
assert.false(canService.can('read auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('read auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('cannot read LDAP auth-method when authorized and feature flag disabled', function (assert) {
|
||||
@@ -40,9 +40,9 @@ module('Unit | Abilities | auth-method', function (hooks) {
|
||||
authorized_actions: ['read'],
|
||||
type: TYPE_AUTH_METHOD_LDAP,
|
||||
});
|
||||
assert.false(canService.can('read auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('read auth-method', authMethod));
|
||||
authMethod.authorized_actions = [];
|
||||
assert.false(canService.can('read auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('read auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('can read non-LDAP auth-method when authorized', function (assert) {
|
||||
@@ -50,9 +50,9 @@ 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));
|
||||
});
|
||||
|
||||
test('cannot read non-LDAP auth-method when unauthorized', function (assert) {
|
||||
@@ -60,16 +60,16 @@ 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));
|
||||
});
|
||||
|
||||
test('cannot make LDAP auth-method primary when feature flag disabled', function (assert) {
|
||||
const authMethod = store.createRecord('auth-method', {
|
||||
type: TYPE_AUTH_METHOD_LDAP,
|
||||
});
|
||||
assert.false(canService.can('makePrimary auth-method', authMethod));
|
||||
assert.false(abilitiesService.can('makePrimary auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('can make LDAP auth-method primary when feature flag enabled', function (assert) {
|
||||
@@ -77,15 +77,15 @@ module('Unit | Abilities | auth-method', function (hooks) {
|
||||
const authMethod = store.createRecord('auth-method', {
|
||||
type: TYPE_AUTH_METHOD_LDAP,
|
||||
});
|
||||
assert.true(canService.can('makePrimary auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('makePrimary auth-method', authMethod));
|
||||
});
|
||||
|
||||
test('can make non-LDAP auth-method primary', function (assert) {
|
||||
const authMethod = store.createRecord('auth-method', {
|
||||
type: TYPE_AUTH_METHOD_OIDC,
|
||||
});
|
||||
assert.true(canService.can('makePrimary auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('makePrimary auth-method', authMethod));
|
||||
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
|
||||
assert.true(canService.can('makePrimary auth-method', authMethod));
|
||||
assert.true(abilitiesService.can('makePrimary auth-method', authMethod));
|
||||
});
|
||||
});
|
||||
@@ -11,7 +11,7 @@ import { MIME_TYPE_ASCIICAST } from 'api/models/channel-recording';
|
||||
module('Unit | Abilities | channel-recording', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let canService;
|
||||
let abilitiesService;
|
||||
let store;
|
||||
let sessionRecording;
|
||||
let connectionRecording;
|
||||
@@ -19,7 +19,7 @@ module('Unit | Abilities | channel-recording', function (hooks) {
|
||||
let noneAsciicastChannel;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
canService = this.owner.lookup('service:can');
|
||||
abilitiesService = this.owner.lookup('service:abilities');
|
||||
store = this.owner.lookup('service:store');
|
||||
|
||||
sessionRecording = store.createRecord('session-recording', {
|
||||
@@ -39,18 +39,20 @@ module('Unit | Abilities | channel-recording', function (hooks) {
|
||||
});
|
||||
|
||||
test('returns true if session recording complete and channel mime type is asciicast', function (assert) {
|
||||
assert.true(canService.can('play channel-recording', asciicastChannel));
|
||||
assert.true(
|
||||
abilitiesService.can('play channel-recording', asciicastChannel),
|
||||
);
|
||||
assert.false(
|
||||
canService.can('play channel-recording', noneAsciicastChannel),
|
||||
abilitiesService.can('play channel-recording', noneAsciicastChannel),
|
||||
);
|
||||
});
|
||||
|
||||
test('returns false if session recording complete and channel mime type is not asciicast', function (assert) {
|
||||
assert.true(
|
||||
canService.can('viewOnly channel-recording', noneAsciicastChannel),
|
||||
abilitiesService.can('viewOnly channel-recording', noneAsciicastChannel),
|
||||
);
|
||||
assert.false(
|
||||
canService.can('viewOnly channel-recording', asciicastChannel),
|
||||
abilitiesService.can('viewOnly channel-recording', asciicastChannel),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -10,7 +10,7 @@ module('Unit | Abilities | model', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it reflects when a resource may be navigated to based on list and create actions', function (assert) {
|
||||
const service = this.owner.lookup('service:can');
|
||||
const service = this.owner.lookup('service:abilities');
|
||||
const model = {
|
||||
authorized_collection_actions: { foobars: [] },
|
||||
};
|
||||
|
||||
@@ -21,32 +21,40 @@ module('Unit | Abilities | credential-library', function (hooks) {
|
||||
|
||||
test('can read credential library type when authorized and feature is enabled', function (assert) {
|
||||
features.enable('ssh-target');
|
||||
const canService = this.owner.lookup('service:can');
|
||||
const abilitiesService = this.owner.lookup('service:abilities');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const credentialLibrary = store.createRecord('credential-library', {
|
||||
authorized_actions: ['read'],
|
||||
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
});
|
||||
assert.true(canService.can('read credential-library', credentialLibrary));
|
||||
assert.true(
|
||||
abilitiesService.can('read credential-library', credentialLibrary),
|
||||
);
|
||||
credentialLibrary.type = TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC;
|
||||
assert.true(canService.can('read credential-library', credentialLibrary));
|
||||
assert.true(
|
||||
abilitiesService.can('read credential-library', credentialLibrary),
|
||||
);
|
||||
});
|
||||
|
||||
test('cannot read credential library type when unauthorized and feature is enabled', function (assert) {
|
||||
features.enable('ssh-target');
|
||||
const canService = this.owner.lookup('service:can');
|
||||
const abilitiesService = this.owner.lookup('service:abilities');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const credentialLibrary = store.createRecord('credential-library', {
|
||||
authorized_actions: [],
|
||||
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
});
|
||||
assert.false(canService.can('read credential-library', credentialLibrary));
|
||||
assert.false(
|
||||
abilitiesService.can('read credential-library', credentialLibrary),
|
||||
);
|
||||
credentialLibrary.type = TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC;
|
||||
assert.false(canService.can('read credential-library', credentialLibrary));
|
||||
assert.false(
|
||||
abilitiesService.can('read credential-library', credentialLibrary),
|
||||
);
|
||||
});
|
||||
|
||||
test('cannot read credential library type when unauthorized and feature is disabled', function (assert) {
|
||||
const canService = this.owner.lookup('service:can');
|
||||
const abilitiesService = this.owner.lookup('service:abilities');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
const credentialLibrary = store.createRecord('credential-library', {
|
||||
@@ -54,13 +62,17 @@ module('Unit | Abilities | credential-library', function (hooks) {
|
||||
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
});
|
||||
assert.false(featuresService.isEnabled('ssh-target'));
|
||||
assert.false(canService.can('read credential-library', credentialLibrary));
|
||||
assert.false(
|
||||
abilitiesService.can('read credential-library', credentialLibrary),
|
||||
);
|
||||
credentialLibrary.type = TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC;
|
||||
assert.false(canService.can('read credential-library', credentialLibrary));
|
||||
assert.false(
|
||||
abilitiesService.can('read credential-library', credentialLibrary),
|
||||
);
|
||||
});
|
||||
|
||||
test('can read vault-generic but not vault-ssh-certificate when authorized and feature is disabled', function (assert) {
|
||||
const canService = this.owner.lookup('service:can');
|
||||
const abilitiesService = this.owner.lookup('service:abilities');
|
||||
const store = this.owner.lookup('service:store');
|
||||
const featuresService = this.owner.lookup('service:features');
|
||||
const credentialLibrary = store.createRecord('credential-library', {
|
||||
@@ -68,8 +80,12 @@ module('Unit | Abilities | credential-library', function (hooks) {
|
||||
type: TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
|
||||
});
|
||||
assert.false(featuresService.isEnabled('ssh-target'));
|
||||
assert.false(canService.can('read credential-library', credentialLibrary));
|
||||
assert.false(
|
||||
abilitiesService.can('read credential-library', credentialLibrary),
|
||||
);
|
||||
credentialLibrary.type = TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC;
|
||||
assert.true(canService.can('read credential-library', credentialLibrary));
|
||||
assert.true(
|
||||
abilitiesService.can('read credential-library', credentialLibrary),
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -9,11 +9,11 @@ import { setupTest } from 'ember-qunit';
|
||||
module('Unit | Abilities | role', 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');
|
||||
});
|
||||
|
||||
@@ -23,9 +23,9 @@ module('Unit | Abilities | role', function (hooks) {
|
||||
authorized_actions: ['set-grant-scopes'],
|
||||
scope: globalScope,
|
||||
});
|
||||
assert.true(canService.can('setGrantScopes role', role));
|
||||
assert.true(abilitiesService.can('setGrantScopes role', role));
|
||||
role.authorized_actions = [];
|
||||
assert.false(canService.can('setGrantScopes role', role));
|
||||
assert.false(abilitiesService.can('setGrantScopes role', role));
|
||||
});
|
||||
|
||||
test('can setGrantScopes on role when authorized and scope is org type', function (assert) {
|
||||
@@ -38,9 +38,9 @@ module('Unit | Abilities | role', function (hooks) {
|
||||
authorized_actions: ['set-grant-scopes'],
|
||||
scope: orgScope,
|
||||
});
|
||||
assert.true(canService.can('setGrantScopes role', role));
|
||||
assert.true(abilitiesService.can('setGrantScopes role', role));
|
||||
role.authorized_actions = [];
|
||||
assert.false(canService.can('setGrantScopes role', role));
|
||||
assert.false(abilitiesService.can('setGrantScopes role', role));
|
||||
});
|
||||
|
||||
test('cannot setGrantScopes on role when authorized and scope is project type', function (assert) {
|
||||
@@ -57,8 +57,8 @@ module('Unit | Abilities | role', function (hooks) {
|
||||
authorized_actions: ['set-grant-scopes'],
|
||||
scope: projectScope,
|
||||
});
|
||||
assert.false(canService.can('setGrantScopes role', role));
|
||||
assert.false(abilitiesService.can('setGrantScopes role', role));
|
||||
role.authorized_actions = [];
|
||||
assert.false(canService.can('setGrantScopes role', role));
|
||||
assert.false(abilitiesService.can('setGrantScopes role', role));
|
||||
});
|
||||
});
|
||||
@@ -10,12 +10,12 @@ module('Unit | Abilities | Scope', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let features;
|
||||
let canService;
|
||||
let abilitiesService;
|
||||
let store;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
store = this.owner.lookup('service:store');
|
||||
canService = this.owner.lookup('service:can');
|
||||
abilitiesService = this.owner.lookup('service:abilities');
|
||||
features = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ module('Unit | Abilities | Scope', function (hooks) {
|
||||
const scopeModel = store.createRecord('scope', {
|
||||
authorized_actions: ['attach-storage-policy'],
|
||||
});
|
||||
assert.true(canService.can('attachStoragePolicy scope', scopeModel));
|
||||
assert.true(abilitiesService.can('attachStoragePolicy scope', scopeModel));
|
||||
});
|
||||
|
||||
test('cannot attach storage policy when unauthorized', function (assert) {
|
||||
@@ -35,7 +35,7 @@ module('Unit | Abilities | Scope', function (hooks) {
|
||||
authorized_actions: [],
|
||||
});
|
||||
|
||||
assert.false(canService.can('attachStoragePolicy scope', scopeModel));
|
||||
assert.false(abilitiesService.can('attachStoragePolicy scope', scopeModel));
|
||||
});
|
||||
|
||||
test('can detach storage policy when authorized', function (assert) {
|
||||
@@ -44,6 +44,6 @@ module('Unit | Abilities | Scope', function (hooks) {
|
||||
const scopeModel = store.createRecord('scope', {
|
||||
authorized_actions: ['detach-storage-policy'],
|
||||
});
|
||||
assert.true(canService.can('detachStoragePolicy scope', scopeModel));
|
||||
assert.true(abilitiesService.can('detachStoragePolicy scope', scopeModel));
|
||||
});
|
||||
});
|
||||
@@ -15,12 +15,12 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let features;
|
||||
let canService;
|
||||
let abilitiesService;
|
||||
let store;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
features = this.owner.lookup('service:features');
|
||||
canService = this.owner.lookup('service:can');
|
||||
abilitiesService = this.owner.lookup('service:abilities');
|
||||
store = this.owner.lookup('service:store');
|
||||
});
|
||||
|
||||
@@ -43,10 +43,13 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
);
|
||||
|
||||
assert.true(
|
||||
canService.can('read session-recording', recordingWithAuthorizedAction),
|
||||
abilitiesService.can(
|
||||
'read session-recording',
|
||||
recordingWithAuthorizedAction,
|
||||
),
|
||||
);
|
||||
assert.false(
|
||||
canService.can(
|
||||
abilitiesService.can(
|
||||
'read session-recording',
|
||||
recordingWithoutAuthorizedAction,
|
||||
),
|
||||
@@ -70,10 +73,13 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
);
|
||||
|
||||
assert.false(
|
||||
canService.can('read session-recording', recordingWithAuthorizedAction),
|
||||
abilitiesService.can(
|
||||
'read session-recording',
|
||||
recordingWithAuthorizedAction,
|
||||
),
|
||||
);
|
||||
assert.false(
|
||||
canService.can(
|
||||
abilitiesService.can(
|
||||
'read session-recording',
|
||||
recordingWithoutAuthorizedAction,
|
||||
),
|
||||
@@ -95,12 +101,12 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('list scope', scopeModelWithAuthorizedAction, {
|
||||
abilitiesService.can('list scope', scopeModelWithAuthorizedAction, {
|
||||
collection: 'session-recordings',
|
||||
}),
|
||||
);
|
||||
assert.false(
|
||||
canService.can('list scope', scopeModelWithoutAuthorizedAction, {
|
||||
abilitiesService.can('list scope', scopeModelWithoutAuthorizedAction, {
|
||||
collection: 'session-recordings',
|
||||
}),
|
||||
);
|
||||
@@ -121,12 +127,12 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('list scope', scopeModelWithAuthorizedAction, {
|
||||
abilitiesService.can('list scope', scopeModelWithAuthorizedAction, {
|
||||
collection: 'session-recordings',
|
||||
}),
|
||||
);
|
||||
assert.false(
|
||||
canService.can('list scope', scopeModelWithoutAuthorizedAction, {
|
||||
abilitiesService.can('list scope', scopeModelWithoutAuthorizedAction, {
|
||||
collection: 'session-recordings',
|
||||
}),
|
||||
);
|
||||
@@ -147,14 +153,18 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('navigate scope', scopeModelWithAuthorizedAction, {
|
||||
abilitiesService.can('navigate scope', scopeModelWithAuthorizedAction, {
|
||||
collection: 'session-recordings',
|
||||
}),
|
||||
);
|
||||
assert.false(
|
||||
canService.can('navigate scope', scopeModelWithoutAuthorizedAction, {
|
||||
collection: 'session-recordings',
|
||||
}),
|
||||
abilitiesService.can(
|
||||
'navigate scope',
|
||||
scopeModelWithoutAuthorizedAction,
|
||||
{
|
||||
collection: 'session-recordings',
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -171,14 +181,18 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
});
|
||||
|
||||
assert.false(
|
||||
canService.can('navigate scope', scopeModelWithAuthorizedAction, {
|
||||
abilitiesService.can('navigate scope', scopeModelWithAuthorizedAction, {
|
||||
collection: 'session-recordings',
|
||||
}),
|
||||
);
|
||||
assert.false(
|
||||
canService.can('navigate scope', scopeModelWithoutAuthorizedAction, {
|
||||
collection: 'session-recordings',
|
||||
}),
|
||||
abilitiesService.can(
|
||||
'navigate scope',
|
||||
scopeModelWithoutAuthorizedAction,
|
||||
{
|
||||
collection: 'session-recordings',
|
||||
},
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -204,10 +218,13 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
);
|
||||
|
||||
assert.true(
|
||||
canService.can('delete session-recording', recordingWithAuthorizedAction),
|
||||
abilitiesService.can(
|
||||
'delete session-recording',
|
||||
recordingWithAuthorizedAction,
|
||||
),
|
||||
);
|
||||
assert.false(
|
||||
canService.can(
|
||||
abilitiesService.can(
|
||||
'delete session-recording',
|
||||
recordingWithoutAuthorizedAction,
|
||||
),
|
||||
@@ -236,10 +253,13 @@ module('Unit | Abilities | session-recording', function (hooks) {
|
||||
);
|
||||
|
||||
assert.false(
|
||||
canService.can('delete session-recording', recordingWithAuthorizedAction),
|
||||
abilitiesService.can(
|
||||
'delete session-recording',
|
||||
recordingWithAuthorizedAction,
|
||||
),
|
||||
);
|
||||
assert.false(
|
||||
canService.can(
|
||||
abilitiesService.can(
|
||||
'delete session-recording',
|
||||
recordingWithoutAuthorizedAction,
|
||||
),
|
||||
|
||||
@@ -14,12 +14,12 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let features;
|
||||
let canService;
|
||||
let abilitiesService;
|
||||
let store;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
store = this.owner.lookup('service:store');
|
||||
canService = this.owner.lookup('service:can');
|
||||
abilitiesService = this.owner.lookup('service:abilities');
|
||||
features = this.owner.lookup('service:features');
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
compositeType: TYPE_STORAGE_BUCKET_PLUGIN_AWS_S3,
|
||||
});
|
||||
|
||||
assert.true(canService.can('read storage-bucket', storageBucket));
|
||||
assert.true(abilitiesService.can('read storage-bucket', storageBucket));
|
||||
});
|
||||
|
||||
test('cannot read storage bucket when unauthorized and feature is enabled', function (assert) {
|
||||
@@ -44,7 +44,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
compositeType: TYPE_STORAGE_BUCKET_PLUGIN_AWS_S3,
|
||||
});
|
||||
|
||||
assert.false(canService.can('read storage-bucket', storageBucket));
|
||||
assert.false(abilitiesService.can('read storage-bucket', storageBucket));
|
||||
});
|
||||
|
||||
test('cannot read storage bucket when authorized and feature is disabled', function (assert) {
|
||||
@@ -54,7 +54,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
compositeType: TYPE_STORAGE_BUCKET_PLUGIN_AWS_S3,
|
||||
});
|
||||
|
||||
assert.false(canService.can('read storage-bucket', storageBucket));
|
||||
assert.false(abilitiesService.can('read storage-bucket', storageBucket));
|
||||
});
|
||||
|
||||
test('cannot read storage bucket when unauthorized and feature is disabled', function (assert) {
|
||||
@@ -64,7 +64,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
compositeType: TYPE_STORAGE_BUCKET_PLUGIN_AWS_S3,
|
||||
});
|
||||
|
||||
assert.false(canService.can('read storage-bucket', storageBucket));
|
||||
assert.false(abilitiesService.can('read storage-bucket', storageBucket));
|
||||
});
|
||||
|
||||
test('can list storage bucket when authorized and in global scope', function (assert) {
|
||||
@@ -77,7 +77,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('list scope', scopeModel, {
|
||||
abilitiesService.can('list scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
@@ -93,7 +93,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.false(
|
||||
canService.can('list scope', scopeModel, {
|
||||
abilitiesService.can('list scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
@@ -109,7 +109,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('list scope', scopeModel, {
|
||||
abilitiesService.can('list scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
@@ -125,7 +125,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('create scope', scopeModel, {
|
||||
abilitiesService.can('create scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
@@ -141,7 +141,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('create scope', scopeModel, {
|
||||
abilitiesService.can('create scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
@@ -157,7 +157,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('create scope', scopeModel, {
|
||||
abilitiesService.can('create scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
@@ -173,7 +173,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.false(
|
||||
canService.can('create scope', scopeModel, {
|
||||
abilitiesService.can('create scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
@@ -189,7 +189,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.true(
|
||||
canService.can('navigate scope', scopeModel, {
|
||||
abilitiesService.can('navigate scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
@@ -203,7 +203,7 @@ module('Unit | Abilities | storage-bucket', function (hooks) {
|
||||
});
|
||||
|
||||
assert.false(
|
||||
canService.can('navigate scope', scopeModel, {
|
||||
abilitiesService.can('navigate scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
module('Unit | Abilities | user', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
let canService;
|
||||
let abilitiesService;
|
||||
let store;
|
||||
let features;
|
||||
|
||||
@@ -24,7 +24,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');
|
||||
features = this.owner.lookup('service:features');
|
||||
instances.user = store.createRecord('user', {
|
||||
@@ -37,7 +37,7 @@ module('Unit | Abilities | user', function (hooks) {
|
||||
features.enable('ldap-auth-methods');
|
||||
instances.account.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.true(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
@@ -46,13 +46,13 @@ module('Unit | Abilities | user', function (hooks) {
|
||||
test('can add non-ldap account to user', function (assert) {
|
||||
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,
|
||||
}),
|
||||
);
|
||||
@@ -61,7 +61,7 @@ module('Unit | Abilities | user', function (hooks) {
|
||||
test('cannot add ldap account to user when feature flag disabled', function (assert) {
|
||||
instances.account.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.false(
|
||||
canService.can('addAccount user', instances.user, {
|
||||
abilitiesService.can('addAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
@@ -71,7 +71,7 @@ module('Unit | Abilities | user', function (hooks) {
|
||||
features.enable('ldap-auth-methods');
|
||||
instances.account.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.true(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
@@ -80,7 +80,7 @@ module('Unit | Abilities | user', function (hooks) {
|
||||
test('cannot remove ldap account from user when feature flag disabled', function (assert) {
|
||||
instances.account.type = TYPE_AUTH_METHOD_LDAP;
|
||||
assert.false(
|
||||
canService.can('removeAccount user', instances.user, {
|
||||
abilitiesService.can('removeAccount user', instances.user, {
|
||||
account: instances.account,
|
||||
}),
|
||||
);
|
||||
@@ -89,13 +89,13 @@ module('Unit | Abilities | user', function (hooks) {
|
||||
test('can remove non-ldap account from user', function (assert) {
|
||||
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,
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user