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
+2
-1
@@ -7,11 +7,12 @@ import Application from '@ember/application';
|
||||
import Resolver from 'ember-resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from 'admin/config/environment';
|
||||
import { extendResolver } from 'ember-can';
|
||||
|
||||
export default class App extends Application {
|
||||
modulePrefix = config.modulePrefix;
|
||||
podModulePrefix = config.podModulePrefix;
|
||||
Resolver = Resolver;
|
||||
Resolver = extendResolver(Resolver);
|
||||
}
|
||||
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
@@ -10,7 +10,7 @@ import { service } from '@ember/service';
|
||||
|
||||
export default class FormUserAddAccountsComponent extends Component {
|
||||
// =properties
|
||||
@service can;
|
||||
@service abilities;
|
||||
/**
|
||||
* Array of selected account IDs.
|
||||
* @type {EmberArray}
|
||||
@@ -36,7 +36,7 @@ export default class FormUserAddAccountsComponent extends Component {
|
||||
const notAddedAccounts = this.args.accounts.filter(
|
||||
(account) =>
|
||||
!alreadyAddedAccountIDs.includes(account.id) &&
|
||||
this.can.can('addAccount user', this.args.model, { account }),
|
||||
this.abilities.can('addAccount user', this.args.model, { account }),
|
||||
);
|
||||
return notAddedAccounts;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import { confirm } from 'core/decorators/confirm';
|
||||
export default class ScopesScopeAliasesIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -41,10 +41,10 @@ export default class ScopesScopeAliasesIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scope, {
|
||||
const canList = this.abilities.can('list model', this.scope, {
|
||||
collection: 'aliases',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scope, {
|
||||
const canCreate = this.abilities.can('create model', this.scope, {
|
||||
collection: 'aliases',
|
||||
});
|
||||
const resource = this.intl.t('resources.alias.title_plural');
|
||||
@@ -84,7 +84,7 @@ export default class ScopesScopeAliasesIndexController extends Controller {
|
||||
)
|
||||
async save(alias) {
|
||||
await alias.save();
|
||||
if (this.can.can('read model', alias)) {
|
||||
if (this.abilities.can('read model', alias)) {
|
||||
await this.router.transitionTo('scopes.scope.aliases.alias', alias);
|
||||
} else {
|
||||
this.router.transitionTo('scopes.scope.aliases');
|
||||
|
||||
@@ -15,7 +15,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsIndexController ext
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -28,10 +28,10 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsIndexController ext
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.authMethod, {
|
||||
const canList = this.abilities.can('list model', this.authMethod, {
|
||||
collection: 'accounts',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.authMethod, {
|
||||
const canCreate = this.abilities.can('create model', this.authMethod, {
|
||||
collection: 'accounts',
|
||||
});
|
||||
const resource = this.intl.t('resources.account.title_plural');
|
||||
@@ -80,7 +80,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsIndexController ext
|
||||
adapterOptions.password = password;
|
||||
}
|
||||
await account.save({ adapterOptions });
|
||||
if (this.can.can('read model', account)) {
|
||||
if (this.abilities.can('read model', account)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method.accounts.account',
|
||||
account,
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsIndexControlle
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -28,10 +28,10 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsIndexControlle
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.authMethod, {
|
||||
const canList = this.abilities.can('list model', this.authMethod, {
|
||||
collection: 'managed-groups',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.authMethod, {
|
||||
const canCreate = this.abilities.can('create model', this.authMethod, {
|
||||
collection: 'managed-groups',
|
||||
});
|
||||
const resource = this.intl.t('resources.managed-group.title_plural');
|
||||
@@ -75,7 +75,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsIndexControlle
|
||||
)
|
||||
async save(managedGroup) {
|
||||
await managedGroup.save();
|
||||
if (this.can.can('read model', managedGroup)) {
|
||||
if (this.abilities.can('read model', managedGroup)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method.managed-groups.managed-group',
|
||||
managedGroup,
|
||||
|
||||
@@ -16,7 +16,7 @@ export default class ScopesScopeAuthMethodsIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service router;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service store;
|
||||
|
||||
@@ -82,10 +82,10 @@ export default class ScopesScopeAuthMethodsIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scopeModel, {
|
||||
const canList = this.abilities.can('list model', this.scopeModel, {
|
||||
collection: 'auth-methods',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scopeModel, {
|
||||
const canCreate = this.abilities.can('create model', this.scopeModel, {
|
||||
collection: 'auth-methods',
|
||||
});
|
||||
const resource = this.intl.t('resources.auth-method.title_plural');
|
||||
@@ -148,7 +148,7 @@ export default class ScopesScopeAuthMethodsIndexController extends Controller {
|
||||
)
|
||||
async save(authMethod) {
|
||||
await authMethod.save();
|
||||
if (this.can.can('read model', authMethod)) {
|
||||
if (this.abilities.can('read model', authMethod)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.auth-methods.auth-method',
|
||||
authMethod,
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -28,10 +28,10 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.credentialStore, {
|
||||
const canList = this.abilities.can('list model', this.credentialStore, {
|
||||
collection: 'credential-libraries',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.credentialStore, {
|
||||
const canCreate = this.abilities.can('create model', this.credentialStore, {
|
||||
collection: 'credential-libraries',
|
||||
});
|
||||
const resource = this.intl.t('resources.credential-library.title_plural');
|
||||
@@ -75,7 +75,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
)
|
||||
async save(credentialLibrary) {
|
||||
await credentialLibrary.save();
|
||||
if (this.can.can('read model', credentialLibrary)) {
|
||||
if (this.abilities.can('read model', credentialLibrary)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.credential-stores.credential-store.credential-libraries.credential-library',
|
||||
credentialLibrary,
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsIndexC
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -28,10 +28,10 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsIndexC
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.credentialStore, {
|
||||
const canList = this.abilities.can('list model', this.credentialStore, {
|
||||
collection: 'credentials',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.credentialStore, {
|
||||
const canCreate = this.abilities.can('create model', this.credentialStore, {
|
||||
collection: 'credentials',
|
||||
});
|
||||
const resource = this.intl.t('resources.credential.title_plural');
|
||||
@@ -75,7 +75,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsIndexC
|
||||
)
|
||||
async save(credential) {
|
||||
await credential.save();
|
||||
if (this.can.can('read credential', credential)) {
|
||||
if (this.abilities.can('read credential', credential)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.credential-stores.credential-store.credentials.credential',
|
||||
credential,
|
||||
|
||||
@@ -15,7 +15,7 @@ import { TYPES_CREDENTIAL_STORE } from 'api/models/credential-store';
|
||||
export default class ScopesScopeCredentialStoresIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
@service intl;
|
||||
|
||||
@@ -58,10 +58,10 @@ export default class ScopesScopeCredentialStoresIndexController extends Controll
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scope, {
|
||||
const canList = this.abilities.can('list model', this.scope, {
|
||||
collection: 'credential-stores',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scope, {
|
||||
const canCreate = this.abilities.can('create model', this.scope, {
|
||||
collection: 'credential-stores',
|
||||
});
|
||||
const resource = this.intl.t('resources.credential-store.title_plural');
|
||||
@@ -88,7 +88,7 @@ export default class ScopesScopeCredentialStoresIndexController extends Controll
|
||||
@notifySuccess('notifications.save-success')
|
||||
async save(credentialStore) {
|
||||
await credentialStore.save();
|
||||
if (this.can.can('read model', credentialStore)) {
|
||||
if (this.abilities.can('read model', credentialStore)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.credential-stores.credential-store',
|
||||
credentialStore,
|
||||
|
||||
@@ -14,7 +14,7 @@ import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
export default class ScopesScopeGroupsIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -41,10 +41,10 @@ export default class ScopesScopeGroupsIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scope, {
|
||||
const canList = this.abilities.can('list model', this.scope, {
|
||||
collection: 'groups',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scope, {
|
||||
const canCreate = this.abilities.can('create model', this.scope, {
|
||||
collection: 'groups',
|
||||
});
|
||||
const resource = this.intl.t('resources.group.title_plural');
|
||||
@@ -84,7 +84,7 @@ export default class ScopesScopeGroupsIndexController extends Controller {
|
||||
)
|
||||
async save(group) {
|
||||
await group.save();
|
||||
if (this.can.can('read model', group)) {
|
||||
if (this.abilities.can('read model', group)) {
|
||||
await this.router.transitionTo('scopes.scope.groups.group', group);
|
||||
} else {
|
||||
this.router.transitionTo('scopes.scope.groups');
|
||||
|
||||
@@ -15,7 +15,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexController e
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
@service store;
|
||||
@@ -29,10 +29,10 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexController e
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.hostCatalog, {
|
||||
const canList = this.abilities.can('list model', this.hostCatalog, {
|
||||
collection: 'host-sets',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.hostCatalog, {
|
||||
const canCreate = this.abilities.can('create model', this.hostCatalog, {
|
||||
collection: 'host-sets',
|
||||
});
|
||||
const resource = this.intl.t('resources.host-set.title_plural');
|
||||
@@ -79,7 +79,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexController e
|
||||
// Fetch newest host set as updates to host set attributes cause an async db update which
|
||||
// updates the version again and can cause a version mismatch if the host set is updated
|
||||
// again and we haven't fetched the newest version.
|
||||
if (this.can.can('read host-set', hostSet)) {
|
||||
if (this.abilities.can('read host-set', hostSet)) {
|
||||
const newestHostSet = await this.store.findRecord(
|
||||
'host-set',
|
||||
hostSet.id,
|
||||
@@ -93,7 +93,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsIndexController e
|
||||
|
||||
await hostSet.save();
|
||||
|
||||
if (this.can.can('read host-set', hostSet)) {
|
||||
if (this.abilities.can('read host-set', hostSet)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set',
|
||||
hostSet,
|
||||
|
||||
@@ -15,7 +15,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsIndexController exte
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -28,10 +28,10 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsIndexController exte
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.hostCatalog, {
|
||||
const canList = this.abilities.can('list model', this.hostCatalog, {
|
||||
collection: 'hosts',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.hostCatalog, {
|
||||
const canCreate = this.abilities.can('create model', this.hostCatalog, {
|
||||
collection: 'hosts',
|
||||
});
|
||||
const resource = this.intl.t('resources.host.title_plural');
|
||||
@@ -74,7 +74,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsIndexController exte
|
||||
)
|
||||
async save(host) {
|
||||
await host.save();
|
||||
if (this.can.can('read model', host)) {
|
||||
if (this.abilities.can('read model', host)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog.hosts.host',
|
||||
host,
|
||||
|
||||
@@ -15,7 +15,7 @@ import { TYPE_CREDENTIAL_STATIC } from 'api/models/host-catalog';
|
||||
export default class ScopesScopeHostCatalogsIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -42,10 +42,10 @@ export default class ScopesScopeHostCatalogsIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scope, {
|
||||
const canList = this.abilities.can('list model', this.scope, {
|
||||
collection: 'host-catalogs',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scope, {
|
||||
const canCreate = this.abilities.can('create model', this.scope, {
|
||||
collection: 'host-catalogs',
|
||||
});
|
||||
const resource = this.intl.t('resources.host-catalog.title_plural');
|
||||
@@ -101,7 +101,7 @@ export default class ScopesScopeHostCatalogsIndexController extends Controller {
|
||||
hostCatalog.credentialType = TYPE_CREDENTIAL_STATIC;
|
||||
}
|
||||
await hostCatalog.save();
|
||||
if (this.can.can('read host-catalog', hostCatalog)) {
|
||||
if (this.abilities.can('read host-catalog', hostCatalog)) {
|
||||
await this.router.transitionTo(
|
||||
'scopes.scope.host-catalogs.host-catalog',
|
||||
hostCatalog,
|
||||
|
||||
@@ -13,7 +13,7 @@ import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
export default class ScopesScopePoliciesIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -26,10 +26,10 @@ export default class ScopesScopePoliciesIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scope, {
|
||||
const canList = this.abilities.can('list model', this.scope, {
|
||||
collection: 'policies',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scope, {
|
||||
const canCreate = this.abilities.can('create model', this.scope, {
|
||||
collection: 'policies',
|
||||
});
|
||||
const resource = this.intl.t('resources.policy.title_plural');
|
||||
@@ -67,7 +67,7 @@ export default class ScopesScopePoliciesIndexController extends Controller {
|
||||
@notifySuccess('notifications.save-success')
|
||||
async save(policy) {
|
||||
await policy.save();
|
||||
if (this.can.can('read model', policy)) {
|
||||
if (this.abilities.can('read model', policy)) {
|
||||
await this.router.transitionTo('scopes.scope.policies.policy', policy);
|
||||
} else {
|
||||
await this.router.transitionTo('scopes.scope.policies');
|
||||
|
||||
@@ -15,7 +15,7 @@ import { GRANT_SCOPE_THIS } from 'api/models/role';
|
||||
export default class ScopesScopeRolesIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -44,10 +44,10 @@ export default class ScopesScopeRolesIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scope, {
|
||||
const canList = this.abilities.can('list model', this.scope, {
|
||||
collection: 'roles',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scope, {
|
||||
const canCreate = this.abilities.can('create model', this.scope, {
|
||||
collection: 'roles',
|
||||
});
|
||||
const resource = this.intl.t('resources.role.title_plural');
|
||||
@@ -98,7 +98,7 @@ export default class ScopesScopeRolesIndexController extends Controller {
|
||||
)
|
||||
async save(role) {
|
||||
await role.save();
|
||||
if (this.can.can('read model', role)) {
|
||||
if (this.abilities.can('read model', role)) {
|
||||
await this.router.transitionTo('scopes.scope.roles.role', role);
|
||||
} else {
|
||||
this.router.transitionTo('scopes.scope.roles');
|
||||
|
||||
@@ -14,7 +14,7 @@ import { TYPE_CREDENTIAL_STATIC } from 'api/models/storage-bucket';
|
||||
export default class ScopesScopeStorageBucketsIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -27,10 +27,10 @@ export default class ScopesScopeStorageBucketsIndexController extends Controller
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list scope', this.scope, {
|
||||
const canList = this.abilities.can('list scope', this.scope, {
|
||||
collection: 'storage-buckets',
|
||||
});
|
||||
const canCreate = this.can.can('create scope', this.scope, {
|
||||
const canCreate = this.abilities.can('create scope', this.scope, {
|
||||
collection: 'storage-buckets',
|
||||
});
|
||||
const resource = this.intl.t('resources.storage-bucket.title_plural');
|
||||
|
||||
@@ -20,7 +20,7 @@ export default class ScopesScopeTargetsIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service intl;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
@service confirm;
|
||||
@service features;
|
||||
@@ -80,10 +80,10 @@ export default class ScopesScopeTargetsIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scope, {
|
||||
const canList = this.abilities.can('list model', this.scope, {
|
||||
collection: 'targets',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scope, {
|
||||
const canCreate = this.abilities.can('create model', this.scope, {
|
||||
collection: 'targets',
|
||||
});
|
||||
const resource = this.intl.t('resources.target.title_plural');
|
||||
@@ -187,7 +187,7 @@ export default class ScopesScopeTargetsIndexController extends Controller {
|
||||
)
|
||||
async save(target) {
|
||||
await target.save();
|
||||
if (this.can.can('read model', target)) {
|
||||
if (this.abilities.can('read model', target)) {
|
||||
await this.router.transitionTo('scopes.scope.targets.target', target);
|
||||
} else {
|
||||
this.router.transitionTo('scopes.scope.targets');
|
||||
|
||||
@@ -13,7 +13,7 @@ export default class ScopesScopeTargetsTargetIndexController extends Controller
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -14,7 +14,7 @@ import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
export default class ScopesScopeUsersIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
@tracked sortAttribute;
|
||||
@@ -41,10 +41,10 @@ export default class ScopesScopeUsersIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list model', this.scope, {
|
||||
const canList = this.abilities.can('list model', this.scope, {
|
||||
collection: 'users',
|
||||
});
|
||||
const canCreate = this.can.can('create model', this.scope, {
|
||||
const canCreate = this.abilities.can('create model', this.scope, {
|
||||
collection: 'users',
|
||||
});
|
||||
const resource = this.intl.t('resources.user.title_plural');
|
||||
@@ -98,7 +98,7 @@ export default class ScopesScopeUsersIndexController extends Controller {
|
||||
)
|
||||
async save(user) {
|
||||
await user.save();
|
||||
if (this.can.can('read model', user)) {
|
||||
if (this.abilities.can('read model', user)) {
|
||||
await this.router.transitionTo('scopes.scope.users.user', user);
|
||||
} else {
|
||||
this.router.transitionTo('scopes.scope.users');
|
||||
|
||||
@@ -14,7 +14,7 @@ import { notifySuccess, notifyError } from 'core/decorators/notify';
|
||||
export default class ScopesScopeWorkersIndexController extends Controller {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
@service router;
|
||||
|
||||
@@ -79,12 +79,16 @@ export default class ScopesScopeWorkersIndexController extends Controller {
|
||||
* @type {string}
|
||||
*/
|
||||
get messageDescription() {
|
||||
const canList = this.can.can('list worker', this.scope, {
|
||||
collection: 'workers',
|
||||
});
|
||||
const canCreate = this.can.can('create worker led worker', this.scope, {
|
||||
const canList = this.abilities.can('list worker', this.scope, {
|
||||
collection: 'workers',
|
||||
});
|
||||
const canCreate = this.abilities.can(
|
||||
'create worker led worker',
|
||||
this.scope,
|
||||
{
|
||||
collection: 'workers',
|
||||
},
|
||||
);
|
||||
const resource = this.intl.t('titles.workers');
|
||||
let description = 'descriptions.neither-list-nor-create';
|
||||
|
||||
@@ -159,7 +163,7 @@ export default class ScopesScopeWorkersIndexController extends Controller {
|
||||
)
|
||||
async save(worker) {
|
||||
await worker.save();
|
||||
if (this.can.can('read model', worker)) {
|
||||
if (this.abilities.can('read model', worker)) {
|
||||
await this.router.transitionTo('scopes.scope.workers.worker', worker);
|
||||
} else {
|
||||
this.router.transitionTo('scopes.scope.workers');
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeAliasesIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -69,7 +69,7 @@ export default class ScopesScopeAliasesIndexRoute extends Route {
|
||||
let totalItems = 0;
|
||||
|
||||
if (
|
||||
this.can.can('list model', scope, {
|
||||
this.abilities.can('list model', scope, {
|
||||
collection: 'aliases',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeAliasesNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -22,7 +22,9 @@ export default class ScopesScopeAliasesNewRoute extends Route {
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (
|
||||
this.can.cannot('create model', scopeModel, { collection: 'aliases' })
|
||||
this.abilities.cannot('create model', scopeModel, {
|
||||
collection: 'aliases',
|
||||
})
|
||||
) {
|
||||
this.router.replaceWith('scopes.scope.aliases');
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeAuthMethodsAuthMethodRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsRoute extends Route
|
||||
let accounts;
|
||||
|
||||
if (
|
||||
this.can.can('list model', authMethod, {
|
||||
this.abilities.can('list model', authMethod, {
|
||||
collection: 'accounts',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsAccountRoute extend
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsNewRoute extends Ro
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -21,7 +21,9 @@ export default class ScopesScopeAuthMethodsAuthMethodAccountsNewRoute extends Ro
|
||||
beforeModel() {
|
||||
const authMethod = this.modelFor('scopes.scope.auth-methods.auth-method');
|
||||
if (
|
||||
this.can.cannot('create model', authMethod, { collection: 'accounts' })
|
||||
this.abilities.cannot('create model', authMethod, {
|
||||
collection: 'accounts',
|
||||
})
|
||||
) {
|
||||
this.router.replaceWith('scopes.scope.auth-methods.auth-method.accounts');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
//=methods
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsRoute extends
|
||||
async model() {
|
||||
const authMethod = this.modelFor('scopes.scope.auth-methods.auth-method');
|
||||
const { id: auth_method_id } = authMethod;
|
||||
const canListManagedGroups = this.can.can('list model', authMethod, {
|
||||
const canListManagedGroups = this.abilities.can('list model', authMethod, {
|
||||
collection: 'managed-groups',
|
||||
});
|
||||
let managedGroups;
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsNewRoute exten
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -21,7 +21,7 @@ export default class ScopesScopeAuthMethodsAuthMethodManagedGroupsNewRoute exten
|
||||
beforeModel() {
|
||||
const authMethod = this.modelFor('scopes.scope.auth-methods.auth-method');
|
||||
if (
|
||||
this.can.cannot('create model', authMethod, {
|
||||
this.abilities.cannot('create model', authMethod, {
|
||||
collection: 'managed-groups',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeAuthMethodsIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
@@ -101,7 +101,9 @@ export default class ScopesScopeAuthMethodsIndexRoute extends Route {
|
||||
let authMethods;
|
||||
let totalItems = 0;
|
||||
let doAuthMethodsExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'auth-methods' })) {
|
||||
if (
|
||||
this.abilities.can('list model', scope, { collection: 'auth-methods' })
|
||||
) {
|
||||
// TODO: Remove storeToken option as this is a temporary fix for auth-methods.
|
||||
const options = { storeToken: false };
|
||||
authMethods = await this.store.query(
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeAuthMethodsNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
@@ -29,7 +29,7 @@ export default class ScopesScopeAuthMethodsNewRoute extends Route {
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (
|
||||
this.can.cannot('create model', scopeModel, {
|
||||
this.abilities.cannot('create model', scopeModel, {
|
||||
collection: 'auth-methods',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreRoute extends Rou
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
);
|
||||
const { id: credential_store_id } = credentialStore;
|
||||
if (
|
||||
this.can.can('list model', credentialStore, {
|
||||
this.abilities.can('list model', credentialStore, {
|
||||
collection: 'credential-libraries',
|
||||
})
|
||||
) {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
@service store;
|
||||
@service router;
|
||||
@service features;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -36,7 +36,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialLibrari
|
||||
'scopes.scope.credential-stores.credential-store',
|
||||
);
|
||||
if (
|
||||
this.can.cannot('create model', credentialStore, {
|
||||
this.abilities.cannot('create model', credentialStore, {
|
||||
collection: 'credential-libraries',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsRoute
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -24,7 +24,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsRoute
|
||||
);
|
||||
const { id: credential_store_id } = credentialStore;
|
||||
if (
|
||||
this.can.can('list model', credentialStore, {
|
||||
this.abilities.can('list model', credentialStore, {
|
||||
collection: 'credentials',
|
||||
})
|
||||
) {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsCreden
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsNewRou
|
||||
|
||||
@service store;
|
||||
@service router;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -31,7 +31,7 @@ export default class ScopesScopeCredentialStoresCredentialStoreCredentialsNewRou
|
||||
'scopes.scope.credential-stores.credential-store',
|
||||
);
|
||||
if (
|
||||
this.can.cannot('create model', credentialStore, {
|
||||
this.abilities.cannot('create model', credentialStore, {
|
||||
collection: 'credentials',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeCredentialStoresIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -90,7 +90,7 @@ export default class ScopesScopeCredentialStoresIndexRoute extends Route {
|
||||
let totalItems = 0;
|
||||
let doCredentialStoresExist = false;
|
||||
if (
|
||||
this.can.can('list model', scope, {
|
||||
this.abilities.can('list model', scope, {
|
||||
collection: 'credential-stores',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class ScopesScopeCredentialStoresNewRoute extends Route {
|
||||
@service store;
|
||||
@service router;
|
||||
@service features;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class ScopesScopeCredentialStoresNewRoute extends Route {
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (
|
||||
this.can.cannot('create model', scopeModel, {
|
||||
this.abilities.cannot('create model', scopeModel, {
|
||||
collection: 'credential-stores',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeGroupsGroupRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeGroupsIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -77,7 +77,7 @@ export default class ScopesScopeGroupsIndexRoute extends Route {
|
||||
let groups = [];
|
||||
let totalItems = 0;
|
||||
let doGroupsExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'groups' })) {
|
||||
if (this.abilities.can('list model', scope, { collection: 'groups' })) {
|
||||
groups = await this.store.query('group', {
|
||||
scope_id,
|
||||
query: { filters, search, sort },
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeGroupsNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -20,7 +20,11 @@ export default class ScopesScopeGroupsNewRoute extends Route {
|
||||
*/
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (this.can.cannot('create model', scopeModel, { collection: 'groups' })) {
|
||||
if (
|
||||
this.abilities.cannot('create model', scopeModel, {
|
||||
collection: 'groups',
|
||||
})
|
||||
) {
|
||||
this.router.replaceWith('scopes.scope.groups');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeHostCatalogsHostCatalogRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -26,7 +26,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou
|
||||
let hostSets;
|
||||
|
||||
if (
|
||||
this.can.can('list model', hostCatalog, {
|
||||
this.abilities.can('list model', hostCatalog, {
|
||||
collection: 'host-sets',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetRoute exte
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
+6
-2
@@ -11,7 +11,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndA
|
||||
|
||||
@service store;
|
||||
@service router;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -22,7 +22,11 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetCreateAndA
|
||||
const hostCatalog = this.modelFor(
|
||||
'scopes.scope.host-catalogs.host-catalog',
|
||||
);
|
||||
if (this.can.cannot('create model', hostCatalog, { collection: 'hosts' })) {
|
||||
if (
|
||||
this.abilities.cannot('create model', hostCatalog, {
|
||||
collection: 'hosts',
|
||||
})
|
||||
) {
|
||||
this.router.replaceWith(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets.host-set.hosts',
|
||||
);
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsHostSetHostsHostR
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsNewRoute extends
|
||||
|
||||
@service store;
|
||||
@service router;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -23,7 +23,9 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsNewRoute extends
|
||||
'scopes.scope.host-catalogs.host-catalog',
|
||||
);
|
||||
if (
|
||||
this.can.cannot('create model', hostCatalog, { collection: 'host-sets' })
|
||||
this.abilities.cannot('create model', hostCatalog, {
|
||||
collection: 'host-sets',
|
||||
})
|
||||
) {
|
||||
this.router.replaceWith(
|
||||
'scopes.scope.host-catalogs.host-catalog.host-sets',
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -26,7 +26,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route
|
||||
let hosts;
|
||||
|
||||
if (
|
||||
this.can.can('list model', hostCatalog, {
|
||||
this.abilities.can('list model', hostCatalog, {
|
||||
collection: 'hosts',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsHostRoute extends Ro
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsNewRoute extends Rou
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -22,7 +22,11 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsNewRoute extends Rou
|
||||
const hostCatalog = this.modelFor(
|
||||
'scopes.scope.host-catalogs.host-catalog',
|
||||
);
|
||||
if (this.can.cannot('create model', hostCatalog, { collection: 'hosts' })) {
|
||||
if (
|
||||
this.abilities.cannot('create model', hostCatalog, {
|
||||
collection: 'hosts',
|
||||
})
|
||||
) {
|
||||
this.router.replaceWith('scopes.scope.host-catalogs.host-catalog.hosts');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeHostCatalogsIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -82,7 +82,9 @@ export default class ScopesScopeHostCatalogsIndexRoute extends Route {
|
||||
let hostCatalogs;
|
||||
let totalItems = 0;
|
||||
let doHostCatalogsExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'host-catalogs' })) {
|
||||
if (
|
||||
this.abilities.can('list model', scope, { collection: 'host-catalogs' })
|
||||
) {
|
||||
hostCatalogs = await this.store.query('host-catalog', {
|
||||
scope_id,
|
||||
query: { search, filters, sort },
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route {
|
||||
|
||||
@service store;
|
||||
@service router;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
|
||||
@@ -29,7 +29,7 @@ export default class ScopesScopeHostCatalogsNewRoute extends Route {
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (
|
||||
this.can.cannot('create model', scopeModel, {
|
||||
this.abilities.cannot('create model', scopeModel, {
|
||||
collection: 'host-catalogs',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopePoliciesRoute extends Route {
|
||||
|
||||
@service store;
|
||||
@service session;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -32,7 +32,7 @@ export default class ScopesScopePoliciesRoute extends Route {
|
||||
const { id: scope_id } = scope;
|
||||
|
||||
if (
|
||||
this.can.can('list model', scope, {
|
||||
this.abilities.can('list model', scope, {
|
||||
collection: 'policies',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopePoliciesNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -21,7 +21,9 @@ export default class ScopesScopePoliciesNewRoute extends Route {
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (
|
||||
this.can.cannot('create model', scopeModel, { collection: 'policies' })
|
||||
this.abilities.cannot('create model', scopeModel, {
|
||||
collection: 'policies',
|
||||
})
|
||||
) {
|
||||
this.router.replaceWith('scopes.scope.policies');
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopePoliciesPolicyRoute extends Route {
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export default class ScopesScopeRolesIndexRoute extends Route {
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service store;
|
||||
|
||||
// =methods
|
||||
@@ -79,7 +79,7 @@ export default class ScopesScopeRolesIndexRoute extends Route {
|
||||
let roles;
|
||||
let totalItems = 0;
|
||||
let doRolesExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'roles' })) {
|
||||
if (this.abilities.can('list model', scope, { collection: 'roles' })) {
|
||||
roles = await this.store.query('role', {
|
||||
scope_id,
|
||||
query: { search, filters, sort },
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeRolesNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -20,7 +20,9 @@ export default class ScopesScopeRolesNewRoute extends Route {
|
||||
*/
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (this.can.cannot('create model', scopeModel, { collection: 'roles' })) {
|
||||
if (
|
||||
this.abilities.cannot('create model', scopeModel, { collection: 'roles' })
|
||||
) {
|
||||
this.router.replaceWith('scopes.scope.roles');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeRolesRoleRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -33,7 +33,7 @@ export default class ScopesScopeScopesIndexRoute extends Route {
|
||||
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service store;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -16,7 +16,7 @@ export default class ScopesScopeSessionRecordingsIndexRoute extends Route {
|
||||
// =services
|
||||
@service store;
|
||||
@service router;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service intl;
|
||||
|
||||
// =attributes
|
||||
@@ -124,7 +124,7 @@ export default class ScopesScopeSessionRecordingsIndexRoute extends Route {
|
||||
: { attributes: [sortAttribute], direction: sortDirection };
|
||||
|
||||
if (
|
||||
this.can.can('list scope', scope, {
|
||||
this.abilities.can('list scope', scope, {
|
||||
collection: 'session-recordings',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -12,7 +12,7 @@ export default class ScopesScopeSessionRecordingsSessionRecordingRoute extends R
|
||||
@service store;
|
||||
@service session;
|
||||
@service router;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import { service } from '@ember/service';
|
||||
export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConnectionChannelRoute extends Route {
|
||||
// =services
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
@service flashMessages;
|
||||
@service intl;
|
||||
|
||||
+4
-2
@@ -8,7 +8,7 @@ import { service } from '@ember/service';
|
||||
|
||||
export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConnectionChannelIndexRoute extends Route {
|
||||
// =services
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service flashMessages;
|
||||
@service intl;
|
||||
|
||||
@@ -22,7 +22,9 @@ export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConne
|
||||
'scopes.scope.session-recordings.session-recording.channels-by-connection.channel',
|
||||
);
|
||||
|
||||
if (this.can.can('getAsciicast channel-recording', channelRecording)) {
|
||||
if (
|
||||
this.abilities.can('getAsciicast channel-recording', channelRecording)
|
||||
) {
|
||||
try {
|
||||
asciicast = await channelRecording.getAsciicast();
|
||||
} catch (e) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { restartableTask, timeout } from 'ember-concurrency';
|
||||
export default class ScopesScopeSessionsIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service store;
|
||||
|
||||
// =attributes
|
||||
@@ -134,7 +134,7 @@ export default class ScopesScopeSessionsIndexRoute extends Route {
|
||||
|
||||
// Preload the associated targets and users into the cache
|
||||
let refreshUsersPromise, refreshTargetsPromise;
|
||||
const canListTargets = this.can.can('list model', scope, {
|
||||
const canListTargets = this.abilities.can('list model', scope, {
|
||||
collection: 'targets',
|
||||
});
|
||||
if (canListTargets) {
|
||||
@@ -152,8 +152,10 @@ export default class ScopesScopeSessionsIndexRoute extends Route {
|
||||
const orgScope = await this.store.findRecord('scope', scope.scope.id);
|
||||
const globalScope = await this.store.findRecord('scope', 'global');
|
||||
const canListUsers =
|
||||
this.can.can('list model', globalScope, { collection: 'users' }) ||
|
||||
this.can.can('list model', orgScope, { collection: 'users' });
|
||||
this.abilities.can('list model', globalScope, {
|
||||
collection: 'users',
|
||||
}) ||
|
||||
this.abilities.can('list model', orgScope, { collection: 'users' });
|
||||
|
||||
if (canListUsers) {
|
||||
refreshUsersPromise = this.store.query(
|
||||
|
||||
@@ -11,7 +11,7 @@ export default class ScopesScopeStorageBucketsRoute extends Route {
|
||||
|
||||
@service store;
|
||||
@service session;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -31,7 +31,7 @@ export default class ScopesScopeStorageBucketsRoute extends Route {
|
||||
const scope = this.modelFor('scopes.scope');
|
||||
const { id: scope_id } = scope;
|
||||
if (
|
||||
this.can.can('list scope', scope, {
|
||||
this.abilities.can('list scope', scope, {
|
||||
collection: 'storage-buckets',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -14,7 +14,7 @@ export default class ScopesScopeStorageBucketsNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =attributes
|
||||
@@ -32,7 +32,7 @@ export default class ScopesScopeStorageBucketsNewRoute extends Route {
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (
|
||||
this.can.cannot('create scope', scopeModel, {
|
||||
this.abilities.cannot('create scope', scopeModel, {
|
||||
collection: 'storage-buckets',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeStorageBucketsStorageBucketRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -17,7 +17,7 @@ import { TYPE_TARGET_SSH, TYPE_TARGET_TCP } from 'api/models/target';
|
||||
export default class ScopesScopeTargetsIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service store;
|
||||
@service session;
|
||||
@service intl;
|
||||
@@ -93,7 +93,7 @@ export default class ScopesScopeTargetsIndexRoute extends Route {
|
||||
filters.type.push({ equals: type });
|
||||
});
|
||||
|
||||
if (this.can.can('list model', scope, { collection: 'sessions' })) {
|
||||
if (this.abilities.can('list model', scope, { collection: 'sessions' })) {
|
||||
await this.store.query(
|
||||
'session',
|
||||
{
|
||||
@@ -133,7 +133,7 @@ export default class ScopesScopeTargetsIndexRoute extends Route {
|
||||
let targets;
|
||||
let totalItems = 0;
|
||||
let doTargetsExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'targets' })) {
|
||||
if (this.abilities.can('list model', scope, { collection: 'targets' })) {
|
||||
targets = await this.store.query('target', {
|
||||
scope_id,
|
||||
query: { search, filters, sort },
|
||||
|
||||
@@ -13,7 +13,7 @@ export default class ScopesScopeTargetsNewRoute extends Route {
|
||||
@service store;
|
||||
@service router;
|
||||
@service features;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =attributes
|
||||
queryParams = {
|
||||
@@ -30,7 +30,9 @@ export default class ScopesScopeTargetsNewRoute extends Route {
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (
|
||||
this.can.cannot('create model', scopeModel, { collection: 'targets' })
|
||||
this.abilities.cannot('create model', scopeModel, {
|
||||
collection: 'targets',
|
||||
})
|
||||
) {
|
||||
this.router.replaceWith('scopes.scope.targets');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeTargetsTargetRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class ScopesScopeUsersIndexRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -80,7 +80,7 @@ export default class ScopesScopeUsersIndexRoute extends Route {
|
||||
let users;
|
||||
let totalItems = 0;
|
||||
let doUsersExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'users' })) {
|
||||
if (this.abilities.can('list model', scope, { collection: 'users' })) {
|
||||
users = await this.store.query('user', {
|
||||
scope_id,
|
||||
query: { search, filters, sort },
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeUsersNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -20,7 +20,9 @@ export default class ScopesScopeUsersNewRoute extends Route {
|
||||
*/
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (this.can.cannot('create model', scopeModel, { collection: 'users' })) {
|
||||
if (
|
||||
this.abilities.cannot('create model', scopeModel, { collection: 'users' })
|
||||
) {
|
||||
this.router.replaceWith('scopes.scope.users');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeUsersUserRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeWorkersRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service session;
|
||||
@service router;
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class ScopesScopeWorkersRoute extends Route {
|
||||
model() {
|
||||
const scope = this.modelFor('scopes.scope');
|
||||
const { id: scope_id } = scope;
|
||||
if (this.can.can('list worker', scope, { collection: 'workers' })) {
|
||||
if (this.abilities.can('list worker', scope, { collection: 'workers' })) {
|
||||
return this.store.query('worker', { scope_id });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeWorkersNewRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
@@ -21,7 +21,7 @@ export default class ScopesScopeWorkersNewRoute extends Route {
|
||||
beforeModel() {
|
||||
const scopeModel = this.modelFor('scopes.scope');
|
||||
if (
|
||||
this.can.cannot('create worker led worker', scopeModel, {
|
||||
this.abilities.cannot('create worker led worker', scopeModel, {
|
||||
collection: 'workers',
|
||||
})
|
||||
) {
|
||||
|
||||
@@ -10,7 +10,7 @@ export default class ScopesScopeWorkersWorkerRoute extends Route {
|
||||
// =services
|
||||
|
||||
@service store;
|
||||
@service can;
|
||||
@service abilities;
|
||||
@service router;
|
||||
|
||||
// =methods
|
||||
|
||||
Reference in new issue
Block a user