Skip to content

Commit a0578ae

Browse files
Merge branch 'main' into ICU-18520-ui-add-sorting-to-sessions-started-column
2 parents 0a62c07 + df24ba6 commit a0578ae

File tree

202 files changed

+1552
-1793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+1552
-1793
lines changed

addons/api/addon/abilities/role.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class InvalidRolePrincipalTypeError extends Error {
1616
export default class RoleAbility extends ModelAbility {
1717
// =services
1818

19-
@service can;
19+
@service abilities;
2020

2121
// =permissions
2222

@@ -64,6 +64,6 @@ export default class RoleAbility extends ModelAbility {
6464
`Expected a role principal of type 'user', 'group', or 'managed-group'. Got '${type}'.`,
6565
);
6666
}
67-
return this.can.can(`read ${type}`, this.model);
67+
return this.abilities.can(`read ${type}`, this.model);
6868
}
6969
}

addons/api/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"broccoli-plugin": "^4.0.7",
3434
"broccoli-source": "^3.0.1",
3535
"ember-auto-import": "^2.10.0",
36-
"ember-can": "^4.2.0",
36+
"ember-can": "^8.0.0",
3737
"ember-cli-babel": "^8.2.0",
3838
"ember-cli-htmlbars": "^6.3.0",
3939
"ember-data": "~5.3.12",
@@ -67,7 +67,7 @@
6767
"ember-load-initializers": "^2.1.2",
6868
"ember-page-title": "^8.2.3",
6969
"ember-qunit": "^8.1.0",
70-
"ember-resolver": "^12.0.1",
70+
"ember-resolver": "^13.1.1",
7171
"ember-source": "~5.12.0",
7272
"ember-source-channel-url": "^3.0.0",
7373
"ember-template-lint": "^6.0.0",

addons/api/tests/dummy/app/app.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import Application from '@ember/application';
77
import Resolver from 'ember-resolver';
88
import loadInitializers from 'ember-load-initializers';
99
import config from 'dummy/config/environment';
10+
import { extendResolver } from 'ember-can';
1011

1112
export default class App extends Application {
1213
modulePrefix = config.modulePrefix;
1314
podModulePrefix = config.podModulePrefix;
14-
Resolver = Resolver;
15+
Resolver = extendResolver(Resolver);
1516
}
1617

1718
loadInitializers(App, config.modulePrefix);

addons/api/tests/unit/abilities/account-test.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,104 +14,104 @@ import {
1414
module('Unit | Abilities | Account', function (hooks) {
1515
setupTest(hooks);
1616

17-
let canService;
17+
let abilitiesService;
1818
let store;
1919

2020
hooks.beforeEach(function () {
21-
canService = this.owner.lookup('service:can');
21+
abilitiesService = this.owner.lookup('service:abilities');
2222
store = this.owner.lookup('service:store');
2323
});
2424

2525
test('it reflects when a given account may set password based on authorized_actions', function (assert) {
2626
const account = store.createRecord('auth-method', {
2727
authorized_actions: ['set-password'],
2828
});
29-
assert.true(canService.can('setPassword account', account));
29+
assert.true(abilitiesService.can('setPassword account', account));
3030
account.authorized_actions = [];
31-
assert.false(canService.can('setPassword account', account));
31+
assert.false(abilitiesService.can('setPassword account', account));
3232
});
3333

3434
test('can read known account types when authorized', function (assert) {
3535
const account = store.createRecord('account', {
3636
authorized_actions: ['read'],
3737
type: TYPE_AUTH_METHOD_OIDC,
3838
});
39-
assert.true(canService.can('read account', account));
39+
assert.true(abilitiesService.can('read account', account));
4040
account.type = TYPE_AUTH_METHOD_PASSWORD;
41-
assert.true(canService.can('read account', account));
41+
assert.true(abilitiesService.can('read account', account));
4242
account.type = TYPE_AUTH_METHOD_LDAP;
43-
assert.true(canService.can('read account', account));
43+
assert.true(abilitiesService.can('read account', account));
4444
account.type = 'no-such-type';
45-
assert.false(canService.can('read account', account));
45+
assert.false(abilitiesService.can('read account', account));
4646
});
4747

4848
test('cannot read accounts when unauthorized', function (assert) {
4949
const account = store.createRecord('account', {
5050
authorized_actions: [],
5151
type: TYPE_AUTH_METHOD_OIDC,
5252
});
53-
assert.false(canService.can('read account', account));
53+
assert.false(abilitiesService.can('read account', account));
5454
account.type = TYPE_AUTH_METHOD_PASSWORD;
55-
assert.false(canService.can('read account', account));
55+
assert.false(abilitiesService.can('read account', account));
5656
account.type = TYPE_AUTH_METHOD_LDAP;
57-
assert.false(canService.can('read account', account));
57+
assert.false(abilitiesService.can('read account', account));
5858
account.type = 'no-such-type';
59-
assert.false(canService.can('read account', account));
59+
assert.false(abilitiesService.can('read account', account));
6060
});
6161

6262
test('can delete known account types when authorized', function (assert) {
6363
const account = store.createRecord('account', {
6464
authorized_actions: ['delete'],
6565
type: TYPE_AUTH_METHOD_OIDC,
6666
});
67-
assert.true(canService.can('delete account', account));
67+
assert.true(abilitiesService.can('delete account', account));
6868
account.type = TYPE_AUTH_METHOD_PASSWORD;
69-
assert.true(canService.can('delete account', account));
69+
assert.true(abilitiesService.can('delete account', account));
7070
account.type = TYPE_AUTH_METHOD_LDAP;
71-
assert.true(canService.can('delete account', account));
71+
assert.true(abilitiesService.can('delete account', account));
7272
account.type = 'no-such-type';
73-
assert.false(canService.can('delete account', account));
73+
assert.false(abilitiesService.can('delete account', account));
7474
});
7575

7676
test('cannot delete accounts when unauthorized', function (assert) {
7777
const account = store.createRecord('account', {
7878
authorized_actions: ['delete'],
7979
type: TYPE_AUTH_METHOD_OIDC,
8080
});
81-
assert.true(canService.can('delete account', account));
81+
assert.true(abilitiesService.can('delete account', account));
8282
account.type = TYPE_AUTH_METHOD_PASSWORD;
83-
assert.true(canService.can('delete account', account));
83+
assert.true(abilitiesService.can('delete account', account));
8484
account.type = TYPE_AUTH_METHOD_LDAP;
85-
assert.true(canService.can('delete account', account));
85+
assert.true(abilitiesService.can('delete account', account));
8686
account.type = 'no-such-type';
87-
assert.false(canService.can('delete account', account));
87+
assert.false(abilitiesService.can('delete account', account));
8888
});
8989

9090
test('can update known account types when authorized', function (assert) {
9191
const account = store.createRecord('account', {
9292
authorized_actions: ['update'],
9393
type: TYPE_AUTH_METHOD_OIDC,
9494
});
95-
assert.true(canService.can('update account', account));
95+
assert.true(abilitiesService.can('update account', account));
9696
account.type = TYPE_AUTH_METHOD_PASSWORD;
97-
assert.true(canService.can('update account', account));
97+
assert.true(abilitiesService.can('update account', account));
9898
account.type = TYPE_AUTH_METHOD_LDAP;
99-
assert.true(canService.can('update account', account));
99+
assert.true(abilitiesService.can('update account', account));
100100
account.type = 'no-such-type';
101-
assert.false(canService.can('update account', account));
101+
assert.false(abilitiesService.can('update account', account));
102102
});
103103

104104
test('cannot update accounts when unauthorized', function (assert) {
105105
const account = store.createRecord('account', {
106106
authorized_actions: [],
107107
type: TYPE_AUTH_METHOD_OIDC,
108108
});
109-
assert.false(canService.can('update account', account));
109+
assert.false(abilitiesService.can('update account', account));
110110
account.type = TYPE_AUTH_METHOD_PASSWORD;
111-
assert.false(canService.can('update account', account));
111+
assert.false(abilitiesService.can('update account', account));
112112
account.type = TYPE_AUTH_METHOD_LDAP;
113-
assert.false(canService.can('update account', account));
113+
assert.false(abilitiesService.can('update account', account));
114114
account.type = 'no-such-type';
115-
assert.false(canService.can('update account', account));
115+
assert.false(abilitiesService.can('update account', account));
116116
});
117117
});

addons/api/tests/unit/abilities/auth-method-test.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import {
1414
module('Unit | Abilities | Auth Method', function (hooks) {
1515
setupTest(hooks);
1616

17-
let canService;
17+
let abilitiesService;
1818
let store;
1919

2020
hooks.beforeEach(function () {
21-
canService = this.owner.lookup('service:can');
21+
abilitiesService = this.owner.lookup('service:abilities');
2222
store = this.owner.lookup('service:store');
2323
});
2424

@@ -27,82 +27,82 @@ module('Unit | Abilities | Auth Method', function (hooks) {
2727
authorized_actions: ['read'],
2828
type: TYPE_AUTH_METHOD_OIDC,
2929
});
30-
assert.true(canService.can('read auth-method', authMethod));
30+
assert.true(abilitiesService.can('read auth-method', authMethod));
3131
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
32-
assert.true(canService.can('read auth-method', authMethod));
32+
assert.true(abilitiesService.can('read auth-method', authMethod));
3333
authMethod.type = TYPE_AUTH_METHOD_LDAP;
34-
assert.true(canService.can('read auth-method', authMethod));
34+
assert.true(abilitiesService.can('read auth-method', authMethod));
3535
authMethod.type = 'no-such-type';
36-
assert.false(canService.can('read auth-method', authMethod));
36+
assert.false(abilitiesService.can('read auth-method', authMethod));
3737
});
3838

3939
test('cannot read auth methods when unauthorized', function (assert) {
4040
const authMethod = store.createRecord('auth-method', {
4141
authorized_actions: [],
4242
type: TYPE_AUTH_METHOD_OIDC,
4343
});
44-
assert.false(canService.can('read auth-method', authMethod));
44+
assert.false(abilitiesService.can('read auth-method', authMethod));
4545
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
46-
assert.false(canService.can('read auth-method', authMethod));
46+
assert.false(abilitiesService.can('read auth-method', authMethod));
4747
authMethod.type = TYPE_AUTH_METHOD_LDAP;
48-
assert.false(canService.can('read auth-method', authMethod));
48+
assert.false(abilitiesService.can('read auth-method', authMethod));
4949
authMethod.type = 'no-such-type';
50-
assert.false(canService.can('read auth-method', authMethod));
50+
assert.false(abilitiesService.can('read auth-method', authMethod));
5151
});
5252

5353
test('can delete known auth method types when authorized', function (assert) {
5454
const authMethod = store.createRecord('auth-method', {
5555
authorized_actions: ['delete'],
5656
type: TYPE_AUTH_METHOD_OIDC,
5757
});
58-
assert.true(canService.can('delete auth-method', authMethod));
58+
assert.true(abilitiesService.can('delete auth-method', authMethod));
5959
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
60-
assert.true(canService.can('delete auth-method', authMethod));
60+
assert.true(abilitiesService.can('delete auth-method', authMethod));
6161
authMethod.type = TYPE_AUTH_METHOD_LDAP;
62-
assert.true(canService.can('delete auth-method', authMethod));
62+
assert.true(abilitiesService.can('delete auth-method', authMethod));
6363
authMethod.type = 'no-such-type';
64-
assert.false(canService.can('delete auth-method', authMethod));
64+
assert.false(abilitiesService.can('delete auth-method', authMethod));
6565
});
6666

6767
test('cannot delete auth methods when unauthorized', function (assert) {
6868
const authMethod = store.createRecord('auth-method', {
6969
authorized_actions: ['delete'],
7070
type: TYPE_AUTH_METHOD_OIDC,
7171
});
72-
assert.true(canService.can('delete auth-method', authMethod));
72+
assert.true(abilitiesService.can('delete auth-method', authMethod));
7373
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
74-
assert.true(canService.can('delete auth-method', authMethod));
74+
assert.true(abilitiesService.can('delete auth-method', authMethod));
7575
authMethod.type = TYPE_AUTH_METHOD_LDAP;
76-
assert.true(canService.can('delete auth-method', authMethod));
76+
assert.true(abilitiesService.can('delete auth-method', authMethod));
7777
authMethod.type = 'no-such-type';
78-
assert.false(canService.can('delete auth-method', authMethod));
78+
assert.false(abilitiesService.can('delete auth-method', authMethod));
7979
});
8080

8181
test('can update known auth method types when authorized', function (assert) {
8282
const authMethod = store.createRecord('auth-method', {
8383
authorized_actions: ['update'],
8484
type: TYPE_AUTH_METHOD_OIDC,
8585
});
86-
assert.true(canService.can('update auth-method', authMethod));
86+
assert.true(abilitiesService.can('update auth-method', authMethod));
8787
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
88-
assert.true(canService.can('update auth-method', authMethod));
88+
assert.true(abilitiesService.can('update auth-method', authMethod));
8989
authMethod.type = TYPE_AUTH_METHOD_LDAP;
90-
assert.true(canService.can('update auth-method', authMethod));
90+
assert.true(abilitiesService.can('update auth-method', authMethod));
9191
authMethod.type = 'no-such-type';
92-
assert.false(canService.can('update auth-method', authMethod));
92+
assert.false(abilitiesService.can('update auth-method', authMethod));
9393
});
9494

9595
test('cannot update auth methods when unauthorized', function (assert) {
9696
const authMethod = store.createRecord('auth-method', {
9797
authorized_actions: [],
9898
type: TYPE_AUTH_METHOD_OIDC,
9999
});
100-
assert.false(canService.can('update auth-method', authMethod));
100+
assert.false(abilitiesService.can('update auth-method', authMethod));
101101
authMethod.type = TYPE_AUTH_METHOD_PASSWORD;
102-
assert.false(canService.can('update auth-method', authMethod));
102+
assert.false(abilitiesService.can('update auth-method', authMethod));
103103
authMethod.type = TYPE_AUTH_METHOD_LDAP;
104-
assert.false(canService.can('update auth-method', authMethod));
104+
assert.false(abilitiesService.can('update auth-method', authMethod));
105105
authMethod.type = 'no-such-type';
106-
assert.false(canService.can('update auth-method', authMethod));
106+
assert.false(abilitiesService.can('update auth-method', authMethod));
107107
});
108108
});

addons/api/tests/unit/abilities/channel-recording-test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import { TYPE_SESSION_RECORDING_SSH } from 'api/models/session-recording';
1111
module('Unit | Ability | channel-recording', function (hooks) {
1212
setupTest(hooks);
1313

14-
let canService;
14+
let abilitiesService;
1515
let store;
1616

1717
hooks.beforeEach(function () {
18-
canService = this.owner.lookup('service:can');
18+
abilitiesService = this.owner.lookup('service:abilities');
1919
store = this.owner.lookup('service:store');
2020
});
2121

@@ -41,7 +41,10 @@ module('Unit | Ability | channel-recording', function (hooks) {
4141
});
4242

4343
assert.true(
44-
canService.can('getAsciicast channel-recording', channelRecordingModel),
44+
abilitiesService.can(
45+
'getAsciicast channel-recording',
46+
channelRecordingModel,
47+
),
4548
);
4649
});
4750

@@ -62,7 +65,10 @@ module('Unit | Ability | channel-recording', function (hooks) {
6265
});
6366

6467
assert.false(
65-
canService.can('getAsciicast channel-recording', channelRecordingModel),
68+
abilitiesService.can(
69+
'getAsciicast channel-recording',
70+
channelRecordingModel,
71+
),
6672
);
6773
});
6874
});

addons/api/tests/unit/abilities/group-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module('Unit | Abilities | Group', function (hooks) {
1010
setupTest(hooks);
1111

1212
test('it reflects when a given group resource may add members based on authorized_actions', function (assert) {
13-
const service = this.owner.lookup('service:can');
13+
const service = this.owner.lookup('service:abilities');
1414
const model = {
1515
authorized_actions: ['add-members'],
1616
};
@@ -20,7 +20,7 @@ module('Unit | Abilities | Group', function (hooks) {
2020
});
2121

2222
test('it reflects when a given group resource may remove members based on authorized_actions', function (assert) {
23-
const service = this.owner.lookup('service:can');
23+
const service = this.owner.lookup('service:abilities');
2424
const model = {
2525
authorized_actions: ['remove-members'],
2626
};

addons/api/tests/unit/abilities/host-set-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module('Unit | Abilities | Host Set', function (hooks) {
1010
setupTest(hooks);
1111

1212
test('it reflects when a given host set resource may add hosts based on authorized_actions', function (assert) {
13-
const service = this.owner.lookup('service:can');
13+
const service = this.owner.lookup('service:abilities');
1414
const model = {
1515
authorized_actions: ['add-hosts'],
1616
};
@@ -20,7 +20,7 @@ module('Unit | Abilities | Host Set', function (hooks) {
2020
});
2121

2222
test('it reflects when a given hostSet resource may remove hosts based on authorized_actions', function (assert) {
23-
const service = this.owner.lookup('service:can');
23+
const service = this.owner.lookup('service:abilities');
2424
const model = {
2525
authorized_actions: ['remove-hosts'],
2626
};

0 commit comments

Comments
 (0)