File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -677,15 +677,24 @@ export class PostgresUserService implements IServicelocator {
677
677
678
678
const privilegeData = await this . postgresRoleService . findPrivilegeByRoleId ( roleArray ) ;
679
679
const privileges = privilegeData . map ( priv => priv . name ) ;
680
-
681
- combinedResult . push ( {
680
+ let cohortIds = [ ] ;
681
+ if ( roleName === 'learner' ) {
682
+ const mappedCohorts = await this . cohortMemberRepository . find ( {
683
+ where : { userId } ,
684
+ select : [ 'cohortId' ]
685
+ } )
686
+ cohortIds = mappedCohorts . map ( id => id . cohortId )
687
+ }
688
+ const result = {
682
689
tenantName : data . tenantname ,
683
690
tenantId : data . tenantId ,
684
691
userTenantMappingId : data . usertenantmappingid ,
685
692
roleId : roleId ,
686
693
roleName : roleName ,
687
- privileges : privileges
688
- } ) ;
694
+ privileges : privileges ,
695
+ ...( roleName === 'learner' && { mappedCohorts : cohortIds } )
696
+ }
697
+ combinedResult . push ( result ) ;
689
698
}
690
699
}
691
700
You can’t perform that action at this time.
0 commit comments