@@ -234,7 +234,7 @@ class ApiGateway {
234234 const { query, variables } = req . body ;
235235 const compilerApi = await this . getCompilerApi ( req . context ) ;
236236
237- const metaConfig = await compilerApi . metaConfig ( {
237+ const metaConfig = await compilerApi . metaConfig ( req . context , {
238238 requestId : req . context . requestId ,
239239 } ) ;
240240
@@ -267,7 +267,7 @@ class ApiGateway {
267267 const compilerApi = await this . getCompilerApi ( req . context ) ;
268268 let schema = compilerApi . getGraphQLSchema ( ) ;
269269 if ( ! schema ) {
270- let metaConfig = await compilerApi . metaConfig ( {
270+ let metaConfig = await compilerApi . metaConfig ( req . context , {
271271 requestId : req . context . requestId ,
272272 } ) ;
273273 metaConfig = this . filterVisibleItemsInMeta ( req . context , metaConfig ) ;
@@ -551,7 +551,7 @@ class ApiGateway {
551551 try {
552552 await this . assertApiScope ( 'meta' , context . securityContext ) ;
553553 const compilerApi = await this . getCompilerApi ( context ) ;
554- const metaConfig = await compilerApi . metaConfig ( {
554+ const metaConfig = await compilerApi . metaConfig ( context , {
555555 requestId : context . requestId ,
556556 includeCompilerId : includeCompilerId || onlyCompilerId
557557 } ) ;
@@ -587,7 +587,7 @@ class ApiGateway {
587587 try {
588588 await this . assertApiScope ( 'meta' , context . securityContext ) ;
589589 const compilerApi = await this . getCompilerApi ( context ) ;
590- const metaConfigExtended = await compilerApi . metaConfigExtended ( {
590+ const metaConfigExtended = await compilerApi . metaConfigExtended ( context , {
591591 requestId : context . requestId ,
592592 } ) ;
593593 const { metaConfig, cubeDefinitions } = metaConfigExtended ;
@@ -1010,7 +1010,7 @@ class ApiGateway {
10101010 } else {
10111011 const metaCacheKey = JSON . stringify ( ctx ) ;
10121012 if ( ! metaCache . has ( metaCacheKey ) ) {
1013- metaCache . set ( metaCacheKey , await compiler . metaConfigExtended ( ctx ) ) ;
1013+ metaCache . set ( metaCacheKey , await compiler . metaConfigExtended ( context , ctx ) ) ;
10141014 }
10151015
10161016 // checking and fetching result status
@@ -1180,6 +1180,7 @@ class ApiGateway {
11801180 } , context ) ;
11811181
11821182 const startTime = new Date ( ) . getTime ( ) ;
1183+ const compilerApi = await this . getCompilerApi ( context ) ;
11831184
11841185 let normalizedQueries : NormalizedQuery [ ] = await Promise . all (
11851186 queries . map (
@@ -1195,8 +1196,14 @@ class ApiGateway {
11951196 }
11961197
11971198 const normalizedQuery = normalizeQuery ( currentQuery , persistent ) ;
1198- let rewrittenQuery = await this . queryRewrite (
1199+ // First apply cube/view level security policies
1200+ const queryWithRlsFilters = await compilerApi . applyRowLevelSecurity (
11991201 normalizedQuery ,
1202+ context
1203+ ) ;
1204+ // Then apply user-supplied queryRewrite
1205+ let rewrittenQuery = await this . queryRewrite (
1206+ queryWithRlsFilters ,
12001207 context ,
12011208 ) ;
12021209
@@ -1693,7 +1700,7 @@ class ApiGateway {
16931700 await this . getNormalizedQueries ( query , context ) ;
16941701
16951702 let metaConfigResult = await ( await this
1696- . getCompilerApi ( context ) ) . metaConfig ( {
1703+ . getCompilerApi ( context ) ) . metaConfig ( request . context , {
16971704 requestId : context . requestId
16981705 } ) ;
16991706
@@ -1803,7 +1810,7 @@ class ApiGateway {
18031810 await this . getNormalizedQueries ( query , context , request . streaming , request . memberExpressions ) ;
18041811
18051812 const compilerApi = await this . getCompilerApi ( context ) ;
1806- let metaConfigResult = await compilerApi . metaConfig ( {
1813+ let metaConfigResult = await compilerApi . metaConfig ( request . context , {
18071814 requestId : context . requestId
18081815 } ) ;
18091816
0 commit comments