Files
threshold-ui/ui/admin/app/routes/scopes.js
T
Randall Morey 94530cec9c Feature cross scope group members (#1196)
* chore: 🤖 add scope column to role principals and group members

* chore: 🤖 add recursion and filtering to user and group mocks

* feat: 🎸 expose groups and roles on projects

* feat: 🎸 enable cross-scope assignment of group members
2022-07-18 16:36:43 -07:00

27 lines
972 B
JavaScript

import Route from '@ember/routing/route';
import { A } from '@ember/array';
export default class ScopesRoute extends Route {
// =methods
/**
* Attempt to load all scopes from the API. This is allowed
* to fail, since in some cases the user may not have permission to read a
* scope directly, but may have permission to read resources under it.
* If scopes fails to load, we still proceed using an empty array.
* @param {object} params
* @param {string} params.scope_id
* @return {Promise{[ScopeModel]}}
*/
async model() {
// Always preload the global scope, if possible, since the query below
// only fetches org scopes.
await this.store.findRecord('scope', 'global').catch(() => {
/* no op */
});
// NOTE: In the absence of a `scope_id` query parameter, this endpoint is
// expected to default to the global scope, thus returning org scopes.
return this.store.findAll('scope').catch(() => A([]));
}
}