auth-backend: getEntityClaims make sure target is group kind

We are interested in the User isMemberOf Group relation. So this is just an additional check that the target is of Group kind.

Signed-off-by: Himanshu Mishra <himanshu@orkohunter.net>
This commit is contained in:
Himanshu Mishra
2021-04-29 13:09:29 +02:00
committed by Fredrik Adelöw
parent 17a26e7ed3
commit a848395e2b
@@ -26,7 +26,11 @@ export function getEntityClaims(entity: UserEntity): TokenParams['claims'] {
const membershipRefs =
entity.relations
?.filter(r => r.type === RELATION_MEMBER_OF)
?.filter(
r =>
r.type === RELATION_MEMBER_OF &&
r.target.kind.toLocaleLowerCase() === 'group',
)
.map(r => stringifyEntityRef(r.target)) ?? [];
return {