fix: 🐛 ICU-11208 fix view of role scopes (#1929)

* fix: 🐛 ICU-11208 fix view of role under org, and
project scope

Fixed view of role under org, and project scope.

✅ Closes: ICU-11208

* refactor: 💡 Refactor scopes in roll

Refactor role to disregard subscopes for project scope

✅ Closes: ICU-11208

* refactor: 💡 refactor test

Refactor test to include test for a role having the correct grand scopes

✅ Closes: ICU-11208

* refactor: 💡 refactor test

Refactor test to test that role fectches scopes correctly

* quick refactor of previous test commit to grab the
role id from the response and use it in the next request

* refactor: 💡 refactor test

refactor test for scope fetching
This commit is contained in:
Devon Anderson authored and GitHub committed 2023-09-28 12:55:52 -04:00
1 parent 4de41763b7
commit 58cd75ef67
2 files changed
+20 -4

No files matched your search

@@ -17,16 +17,18 @@ export default class ScopesScopeRolesRoleIndexRoute extends Route {
*/
async afterModel() {
const currentScope = this.modelFor('scopes.scope');
const scopes = await this.store.query('scope', {
scope_id: currentScope.id,
});
let subScopes = [];
//await the store query to fix ember's proxy promise deprecation warning
if (!currentScope.isProject) {
const scopes = await this.store.query('scope', {
scope_id: currentScope.id,
});
subScopes = await Promise.all(
scopes.map(async (scope) => ({
model: scope,
subScopes: await this.store.query('scope', { scope_id: scope.id }),
subScopes: !scope.isProject
? await this.store.query('scope', { scope_id: scope.id })
: [],
}))
);
}