Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

add global tenant for report definition urls #324

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions kibana-reports/server/routes/utils/converters/backendToUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,15 @@ const getUiQueryUrl = (
const timeFrom = moment(beginTimeMs).toISOString();
const timeTo = moment(endTimeMs).toISOString();
let queryUrl = `${baseUrl}?_g=(time:(from:'${timeFrom}',to:'${timeTo}'))`;
if (tenant) {
if (tenant === '__user__') {
if (tenant !== undefined) {
if (tenant === '') {
tenant = 'global';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the user creates a new tenant with name "global"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then after this if else check, tenant variable will be assigned with global. It will be added to the url without any issue. Same for global tenant. they follow the same format in the url ?security_tenant=global or ?security_tenant=<customized_tenant_name>. From the actual behavior point, it's out of our control. Not sure seucirty plugin has a way to distinguish that.

} else if (tenant === '__user__') {
tenant = 'private';
}
queryUrl = addTenantToURL(queryUrl, tenant);
}

return queryUrl;
};

Expand Down