Skip to content

Commit

Permalink
feat: extra_jwt support to be used in dashboard_rbac (#1021)
Browse files Browse the repository at this point in the history
* feat: extra_jwt support to be used in dashboard_rbac for BE validation of data-access based on dashboard access

* test: extra_jwt existence

* chore: extra_jwt in BaseFormData

* fix: add missing ff to enum

* fix: missing :

* chore: add extra_jwt to QueryContext

* Update QueryFormData.ts

* Update buildQueryContext.ts

* Update buildQueryContext.test.ts

* fix: text

* Update Query.ts

* Update QueryFormData.ts
  • Loading branch information
amitmiran137 authored and zhaoyongjie committed Nov 26, 2021
1 parent 943348b commit e71d929
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ export default function buildQueryContext(
}),
result_format: formData.result_format || 'json',
result_type: formData.result_type || 'full',
extra_jwt: formData.extra_jwt,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export interface QueryContext {
/** Response format */
result_format: string;
queries: QueryObject[];
extra_jwt?: string;
}

export default {};
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export interface BaseFormData extends TimeRange, FormDataResidual {
annotation_layers?: AnnotationLayer[];
url_params?: Record<string, string>;
custom_params?: Record<string, string>;
extra_jwt?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export enum FeatureFlag {
GLOBAL_ASYNC_QUERIES = 'GLOBAL_ASYNC_QUERIES',
ENABLE_TEMPLATE_PROCESSING = 'ENABLE_TEMPLATE_PROCESSING',
ENABLE_EXPLORE_DRAG_AND_DROP = 'ENABLE_EXPLORE_DRAG_AND_DROP',
DASHBOARD_RBAC = 'DASHBOARD_RBAC',
}
export type ScheduleQueriesProps = {
JSONSCHEMA: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ describe('buildQueryContext', () => {
expect(queryContext.result_format).toBe('json');
expect(queryContext.result_type).toBe('full');
});

it('should build with extra_jwt', () => {
const queryContext = buildQueryContext({
datasource: '5__table',
viz_type: 'table',
extra_jwt: 'ABCDEFG',
});
expect(queryContext.datasource.id).toBe(5);
expect(queryContext.datasource.type).toBe('table');
expect(queryContext.extra_jwt).toBe('ABCDEFG');
});
it('should build datasource for druid sources and set force to true', () => {
const queryContext = buildQueryContext({
datasource: '5__druid',
Expand Down

0 comments on commit e71d929

Please sign in to comment.