diff --git a/public/plugin.tsx b/public/plugin.tsx index ab9f8b3cd..ca1d47388 100644 --- a/public/plugin.tsx +++ b/public/plugin.tsx @@ -74,6 +74,7 @@ const APP_LIST_FOR_READONLY_ROLE = [APP_ID_HOME, APP_ID_DASHBOARDS, APP_ID_OPENS const GLOBAL_TENANT_RENDERING_TEXT = 'Global'; const PRIVATE_TENANT_RENDERING_TEXT = 'Private'; const GLOBAL_TENANT = ''; +const PRIVATE_TENANT = '__user__'; export class SecurityPlugin implements @@ -169,9 +170,9 @@ export class SecurityPlugin dataType: 'string', render: (value: any[][]) => { let text = value[0][0]; - if (text === null || text === GLOBAL_TENANT) { + if (isGlobalTenant(text)) { text = GLOBAL_TENANT_RENDERING_TEXT; - } else if (text.startsWith('__user__')) { + } else if (isPrivateTenant(text)) { text = PRIVATE_TENANT_RENDERING_TEXT; } text = i18n.translate('savedObjectsManagement.objectsTable.table.columnTenantName', { @@ -213,3 +214,11 @@ export class SecurityPlugin public stop() {} } + +function isPrivateTenant(selectedTenant: string) { + return selectedTenant.startsWith('__user__'); +} + +function isGlobalTenant(selectedTenant: string) { + return selectedTenant === null || selectedTenant === GLOBAL_TENANT; +}