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
This commit is contained in:
1 parent
31cf696902
commit
94530cec9c
5 files changed
+13
-9
No files matched your search
@@ -17,7 +17,7 @@ export default function (server) {
|
|||||||
'withChildren'
|
'withChildren'
|
||||||
)[0];
|
)[0];
|
||||||
|
|
||||||
server.create('user', { id: 'authenticateduser' });
|
server.create('user', { id: 'authenticateduser', scope: globalScope });
|
||||||
|
|
||||||
// Auth
|
// Auth
|
||||||
const globalAuthMethods = server.createList(
|
const globalAuthMethods = server.createList(
|
||||||
|
|||||||
@@ -62,9 +62,6 @@
|
|||||||
<row.cell>
|
<row.cell>
|
||||||
<ScopeBadge @scope={{principal.scopeModel}} />
|
<ScopeBadge @scope={{principal.scopeModel}} />
|
||||||
</row.cell>
|
</row.cell>
|
||||||
<row.cell>
|
|
||||||
<ScopeBadge @scope={{principal.scopeModel}} />
|
|
||||||
</row.cell>
|
|
||||||
<row.cell>{{principal.description}}</row.cell>
|
<row.cell>{{principal.description}}</row.cell>
|
||||||
</body.row>
|
</body.row>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|||||||
@@ -13,7 +13,12 @@ export default class ScopesRoute extends Route {
|
|||||||
* @param {string} params.scope_id
|
* @param {string} params.scope_id
|
||||||
* @return {Promise{[ScopeModel]}}
|
* @return {Promise{[ScopeModel]}}
|
||||||
*/
|
*/
|
||||||
model() {
|
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
|
// NOTE: In the absence of a `scope_id` query parameter, this endpoint is
|
||||||
// expected to default to the global scope, thus returning org scopes.
|
// expected to default to the global scope, thus returning org scopes.
|
||||||
return this.store.findAll('scope').catch(() => A([]));
|
return this.store.findAll('scope').catch(() => A([]));
|
||||||
|
|||||||
@@ -26,11 +26,10 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
|
|||||||
* @return {Promise{GroupModel, [UserModel]}}
|
* @return {Promise{GroupModel, [UserModel]}}
|
||||||
*/
|
*/
|
||||||
model() {
|
model() {
|
||||||
const group = this.modelFor('scopes.scope.groups.group');
|
|
||||||
const { scopeID: scope_id } = group;
|
|
||||||
return hash({
|
return hash({
|
||||||
group: this.modelFor('scopes.scope.groups.group'),
|
group: this.modelFor('scopes.scope.groups.group'),
|
||||||
users: this.store.query('user', { scope_id }),
|
// load all users from all scopes
|
||||||
|
users: this.store.query('user', { scope_id: 'global', recursive: true }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
find,
|
find,
|
||||||
findAll,
|
findAll,
|
||||||
getRootElement,
|
getRootElement,
|
||||||
//setupOnerror,
|
setupOnerror,
|
||||||
} from '@ember/test-helpers';
|
} from '@ember/test-helpers';
|
||||||
import { setupApplicationTest } from 'ember-qunit';
|
import { setupApplicationTest } from 'ember-qunit';
|
||||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||||
@@ -115,6 +115,9 @@ module('Acceptance | authentication', function (hooks) {
|
|||||||
|
|
||||||
test('visiting auth method when the scope cannot be loaded is still allowed', async function (assert) {
|
test('visiting auth method when the scope cannot be loaded is still allowed', async function (assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
setupOnerror(() => {
|
||||||
|
// do nothing, otherwise an uncaught adapter error will fail the test
|
||||||
|
});
|
||||||
this.server.get('/scopes', () => {
|
this.server.get('/scopes', () => {
|
||||||
return new Response(404);
|
return new Response(404);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user