Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions public/apps/account/account-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,12 @@ export async function setupTopNavButton(coreStart: CoreStart, config: ClientConf
}

let tenant: string | undefined;
if (config.multitenancy.enabled && config.multitenancy.enable_aggregation_view) {
if (config.multitenancy.enabled) {
try {
tenant = await fetchCurrentTenant(coreStart.http);
} catch (e) {
console.log(e);
}
} else {
tenant = accountInfo.user_requested_tenant;
}

let shouldShowTenantPopup = true;
Expand Down
1 change: 1 addition & 0 deletions public/apps/configuration/utils/tenant-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const PRIVATE_TENANT = '__user__';
export const DEFAULT_TENANT = 'default';
export const GLOBAL_TENANT_RENDERING_TEXT = 'Global';
export const PRIVATE_TENANT_RENDERING_TEXT = 'Private';

export const GLOBAL_USER_DICT: { [key: string]: string } = {
Label: 'Global',
Value: GLOBAL_TENANT,
Expand Down
22 changes: 17 additions & 5 deletions server/saved_objects/saved_objects_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { Config } from 'packages/osd-config/target';
import { SecurityPluginConfigType } from '..';
import {
DEFAULT_TENANT,
globalTenantName,
GLOBAL_TENANT,
isPrivateTenant,
PRIVATE_TENANT,
Expand Down Expand Up @@ -95,17 +96,27 @@ export class SecuritySavedObjectsClientWrapper {
availableTenantNames.push(GLOBAL_TENANT);
}
if (isPrivateEnabled) {
availableTenantNames.push(PRIVATE_TENANT + state.authInfo?.user_name);
availableTenantNames.push(PRIVATE_TENANT + username);
}
const typeToNamespacesMap = {};
if (selectedTenant === '__user__') {
namespaceValue = selectedTenant + username;
if (availableTenantNames.includes(globalTenantName)) {
let index = availableTenantNames.indexOf(globalTenantName);
if (index > -1) {
availableTenantNames.splice(index, 1);
}
index = availableTenantNames.indexOf(username!);
if (index > -1) {
availableTenantNames.splice(index, 1);
}
}
const typeToNamespacesMap: any = {};
if (isPrivateTenant(selectedTenant!)) {
namespaceValue = selectedTenant! + username;
}
const searchTypes = Array.isArray(options.type) ? options.type : [options.type];
searchTypes.forEach((t) => {
if (t === 'config') {
if ('namespaces' in options) {
if (options.namespaces.includes(namespaceValue)) {
if (options.namespaces!.includes(namespaceValue!)) {
typeToNamespacesMap[t] = [namespaceValue];
}
} else {
Expand All @@ -122,6 +133,7 @@ export class SecuritySavedObjectsClientWrapper {
options.typeToNamespacesMap = new Map(Object.entries(typeToNamespacesMap));
options.type = '';
options.namespaces = [];

return await wrapperOptions.client.find(options);
};

Expand Down