Merge pull request #5155 from jmgrimes/group-members-support

Added support for 'members' field of Group catalog model entity.
This commit is contained in:
Fredrik Adelöw
2021-03-30 09:03:55 +02:00
committed by GitHub
7 changed files with 78 additions and 1 deletions
@@ -353,12 +353,13 @@ describe('BuiltinKindsEntityProcessor', () => {
type: 't',
parent: 'p',
children: ['c'],
members: ['m'],
},
};
await processor.postProcessEntity(entity, location, emit);
expect(emit).toBeCalledTimes(4);
expect(emit).toBeCalledTimes(6);
expect(emit).toBeCalledWith({
type: 'relation',
relation: {
@@ -391,6 +392,22 @@ describe('BuiltinKindsEntityProcessor', () => {
target: { kind: 'Group', namespace: 'default', name: 'c' },
},
});
expect(emit).toBeCalledWith({
type: 'relation',
relation: {
source: { kind: 'User', namespace: 'default', name: 'm' },
type: 'memberOf',
target: { kind: 'Group', namespace: 'default', name: 'n' },
},
});
expect(emit).toBeCalledWith({
type: 'relation',
relation: {
source: { kind: 'Group', namespace: 'default', name: 'n' },
type: 'hasMember',
target: { kind: 'User', namespace: 'default', name: 'm' },
},
});
});
});
});
@@ -226,6 +226,12 @@ export class BuiltinKindsEntityProcessor implements CatalogProcessor {
RELATION_PARENT_OF,
RELATION_CHILD_OF,
);
doEmit(
group.spec.members,
{ defaultKind: 'User', defaultNamespace: selfRef.namespace },
RELATION_HAS_MEMBER,
RELATION_MEMBER_OF,
);
}
/*