File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
packages/cubejs-schema-compiler Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -248,8 +248,9 @@ export class CubePropContextTranspiler implements TranspilerInterface {
248248 protected static transformUserAttributesMemberExpression ( path : NodePath < t . MemberExpression > ) {
249249 // Check if this is userAttributes.someProperty (object should be identifier named 'userAttributes')
250250 if ( t . isIdentifier ( path . node . object , { name : 'userAttributes' } ) ) {
251- // Replace userAttributes with securityContext.cubeCloud.userAttributes
252- const securityContext = t . identifier ( 'securityContext' ) ;
251+ // Replace userAttributes with COMPILE_CONTEXT.securityContext.cubeCloud.userAttributes
252+ const compileContext = t . identifier ( 'COMPILE_CONTEXT' ) ;
253+ const securityContext = t . memberExpression ( compileContext , t . identifier ( 'securityContext' ) ) ;
253254 const cubeCloud = t . memberExpression ( securityContext , t . identifier ( 'cubeCloud' ) ) ;
254255 const userAttributes = t . memberExpression ( cubeCloud , t . identifier ( 'userAttributes' ) ) ;
255256 const newMemberExpression = t . memberExpression ( userAttributes , path . node . property , path . node . computed ) ;
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ describe('Transpilers', () => {
5757 sql: 'SELECT * FROM users',
5858 dimensions: {
5959 userId: {
60- sql: \`CASE WHEN userId = '\${securityContext.cubeCloud.userAttributes.userId}' THEN id ELSE 0 END\`,
60+ sql: \`CASE WHEN userId = '\${COMPILE_CONTEXT. securityContext.cubeCloud.userAttributes.userId}' THEN id ELSE 0 END\`,
6161 type: 'string'
6262 }
6363 }
@@ -71,7 +71,7 @@ describe('Transpilers', () => {
7171 timeDimensions : [ ] ,
7272 timezone : 'America/Los_Angeles' ,
7373 contextSymbols : {
74- securityContext : { userId : 'user123' }
74+ securityContext : { cubeCloud : { userAttributes : { userId : 'user123' } } }
7575 }
7676 } ) ;
7777
You can’t perform that action at this time.
0 commit comments