fix: 🐛 move query inside list permission check (#2222)
✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13356
This commit is contained in:
1 parent
1d7892230c
commit
c2c0b38187
6 files changed
+13
-14
No files matched your search
@@ -123,7 +123,6 @@ export default class ScopesScopeCredentialStoresIndexController extends Controll
|
||||
*/
|
||||
@action
|
||||
applyFilter(paramKey, selectedItems) {
|
||||
console.log('appy filter', paramKey, selectedItems);
|
||||
this[paramKey] = [...selectedItems];
|
||||
this.page = 1;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ export default class ScopesScopeCredentialStoresIndexRoute extends Route {
|
||||
|
||||
let credentialStores;
|
||||
let totalItems = 0;
|
||||
let credentialStoresExist = false;
|
||||
if (
|
||||
this.can.can('list model', scope, {
|
||||
collection: 'credential-stores',
|
||||
@@ -62,11 +63,11 @@ export default class ScopesScopeCredentialStoresIndexRoute extends Route {
|
||||
pageSize,
|
||||
});
|
||||
totalItems = credentialStores.meta?.totalItems;
|
||||
credentialStoresExist = await this.getCredentialStoresExist(
|
||||
scope_id,
|
||||
totalItems,
|
||||
);
|
||||
}
|
||||
const credentialStoresExist = await this.getCredentialStoresExist(
|
||||
scope_id,
|
||||
totalItems,
|
||||
);
|
||||
|
||||
return { credentialStores, credentialStoresExist, totalItems };
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export default class ScopesScopeGroupsIndexRoute extends Route {
|
||||
const { id: scope_id } = scope;
|
||||
let groups = [];
|
||||
let totalItems = 0;
|
||||
let groupsExist = false;
|
||||
const filters = { scope_id: [{ equals: scope_id }] };
|
||||
|
||||
if (this.can.can('list model', scope, { collection: 'groups' })) {
|
||||
@@ -47,10 +48,9 @@ export default class ScopesScopeGroupsIndexRoute extends Route {
|
||||
pageSize,
|
||||
});
|
||||
totalItems = groups.meta?.totalItems;
|
||||
groupsExist = await this.getGroupsExist(scope_id, totalItems);
|
||||
}
|
||||
|
||||
const groupsExist = await this.getGroupsExist(scope_id, totalItems);
|
||||
|
||||
return { groups, groupsExist, totalItems };
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ export default class ScopesScopeHostCatalogsIndexRoute extends Route {
|
||||
|
||||
let hostCatalogs;
|
||||
let totalItems = 0;
|
||||
let hostCatalogsExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'host-catalogs' })) {
|
||||
hostCatalogs = await this.store.query('host-catalog', {
|
||||
query: { search, filters },
|
||||
@@ -52,13 +53,9 @@ export default class ScopesScopeHostCatalogsIndexRoute extends Route {
|
||||
pageSize,
|
||||
});
|
||||
totalItems = hostCatalogs.meta?.totalItems;
|
||||
hostCatalogsExist = await this.getHostCatalogsExist(scope_id, totalItems);
|
||||
}
|
||||
|
||||
const hostCatalogsExist = await this.getHostCatalogsExist(
|
||||
scope_id,
|
||||
totalItems,
|
||||
);
|
||||
|
||||
return { hostCatalogs, totalItems, hostCatalogsExist };
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ export default class ScopesScopeRolesIndexRoute extends Route {
|
||||
|
||||
let roles;
|
||||
let totalItems = 0;
|
||||
let rolesExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'roles' })) {
|
||||
roles = await this.store.query('role', {
|
||||
query: { search, filters },
|
||||
@@ -49,8 +50,8 @@ export default class ScopesScopeRolesIndexRoute extends Route {
|
||||
pageSize,
|
||||
});
|
||||
totalItems = roles.meta?.totalItems;
|
||||
rolesExist = await this.getRolesExist(scope_id, totalItems);
|
||||
}
|
||||
const rolesExist = await this.getRolesExist(scope_id, totalItems);
|
||||
|
||||
return { roles, rolesExist, totalItems };
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ export default class ScopesScopeUsersIndexRoute extends Route {
|
||||
|
||||
let users;
|
||||
let totalItems = 0;
|
||||
let usersExist = false;
|
||||
if (this.can.can('list model', scope, { collection: 'users' })) {
|
||||
users = await this.store.query('user', {
|
||||
query: { search, filters },
|
||||
@@ -50,8 +51,8 @@ export default class ScopesScopeUsersIndexRoute extends Route {
|
||||
pageSize,
|
||||
});
|
||||
totalItems = users.meta?.totalItems;
|
||||
usersExist = await this.getUsersExist(scope_id, totalItems);
|
||||
}
|
||||
const usersExist = await this.getUsersExist(scope_id, totalItems);
|
||||
|
||||
return { users, usersExist, totalItems };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user