File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -357,23 +357,22 @@ export class VirtruPDP implements IPolicyDecisionPoint {
357357 return [ ] ;
358358 }
359359
360- const abacRooms = await Rooms . findPrivateRoomsByIdsWithAbacAttributes ( roomIds , {
360+ const abacRoomCursor = Rooms . findPrivateRoomsByIdsWithAbacAttributes ( roomIds , {
361361 projection : { _id : 1 , abacAttributes : 1 } ,
362- } ) . toArray ( ) ;
362+ } ) ;
363363
364- const abacRoomById = Object . fromEntries ( abacRooms . map ( ( room ) => [ room . _id , room ] ) ) ;
364+ const abacRoomById = new Map < string , IRoom > ( ) ;
365+ for await ( const room of abacRoomCursor ) {
366+ abacRoomById . set ( room . _id , room ) ;
367+ }
365368
366369 const entries = users
367370 . map ( ( user ) => {
368- const rooms = ( user . __rooms ?? [ ] ) . map ( ( rid ) => abacRoomById [ rid ] ) . filter ( Boolean ) ;
371+ const rooms = ( user . __rooms ?? [ ] ) . map ( ( rid ) => abacRoomById . get ( rid ) ) . filter ( isTruthy ) ;
369372 return rooms . length ? { user, rooms } : null ;
370373 } )
371374 . filter ( isTruthy ) ;
372375
373- if ( ! entries . length ) {
374- return [ ] ;
375- }
376-
377376 return this . evaluateUserRooms ( entries ) ;
378377 }
379378
You can’t perform that action at this time.
0 commit comments