-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Saved Object Aggregation View] Use namespace registry to add tenant filter #1169
Changes from 5 commits
1978641
1b81368
91c999e
92cf494
ee9ead0
056d04c
6d919d5
571a130
b49644b
ce58514
abfae9a
0e1178b
30fd8f5
0993186
c5a3a0f
e946d2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,6 +179,33 @@ export function transformRoleTenantPermissions( | |
})); | ||
} | ||
|
||
export function getNamespacesToRegister(accountInfo: any) { | ||
const tenants = accountInfo.tenants || {}; | ||
const availableTenantNames = Object.keys(tenants!); | ||
const namespacesToRegister = availableTenantNames.map((tenant) => { | ||
if (tenant === globalTenantName) { | ||
return { | ||
id: GLOBAL_USER_DICT.Value, | ||
name: GLOBAL_USER_DICT.Label, | ||
}; | ||
} else if (tenant === accountInfo.user_name) { | ||
return { | ||
id: `${PRIVATE_USER_DICT.Value}${accountInfo.user_name}`, | ||
name: PRIVATE_USER_DICT.Label, | ||
}; | ||
} | ||
return { | ||
id: tenant, | ||
name: tenant, | ||
}; | ||
}); | ||
namespacesToRegister.push({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will always include |
||
id: DEFAULT_TENANT, | ||
name: DEFAULT_TENANT, | ||
}); | ||
return namespacesToRegister; | ||
} | ||
|
||
export function isPrivateTenant(selectedTenant: string | null) { | ||
return selectedTenant !== null && selectedTenant === PRIVATE_TENANT_SYMBOL; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cliu123 I noticed when testing this change that the following data structure comes out as:
Will the values in this map of tenants ever contain
false
? If so, should this skip over the tenants where the value in this object isfalse
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cwperks You might have logged in as admin, then you are expected to have all tenant permissions. If you create a role, grant permission to a specific tenant, create a user, map the role to the user, and log in as the user, then you'll see the difference.