-
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
Conversation
…nant filter Signed-off-by: Craig Perkins <[email protected]>
name: tenant, | ||
}; | ||
}); | ||
namespacesToRegister.push({ |
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.
This will always include default
in the dropdown. default
comes into play when OSD deployments with existing saved objects enable the saved object aggregation view feature. These objects do not have the namespace
of the saved object populated and will be given the default
(or null
) namespace.
Signed-off-by: Craig Perkins <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1169 +/- ##
==========================================
- Coverage 71.80% 71.78% -0.03%
==========================================
Files 88 88
Lines 2011 2027 +16
Branches 265 274 +9
==========================================
+ Hits 1444 1455 +11
- Misses 505 509 +4
- Partials 62 63 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@cwperks Is this ready for review? |
@cliu123 This is ready for review now that the companion PR is merged. |
@@ -179,6 +179,33 @@ export function transformRoleTenantPermissions( | |||
})); | |||
} | |||
|
|||
export function getNamespacesToRegister(accountInfo: any) { | |||
const tenants = accountInfo.tenants || {}; |
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:
{
"global_tenant": true,
"admin_tenant": true,
"admin": true
}
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 is false
?
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.
…uest Signed-off-by: Craig Perkins <[email protected]>
…rity-dashboards-plugin into register-namespaces
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 The changes in saved_objects_wrapper.ts
would break the aggregation functionality. With the changes, the Saved Objects table no longer aggregates object from all namespaces. Please consider the following changes:
if ('namespaces' in options && !options.namespaces) {
// Requests coming from "Index Patterns" table have "namespaces: undefined" in the options.
_.assign(options, { namespaces: availableTenantNames });
} else {
// Requests coming from "Save Objects" table do not have namespaces in the options.
// Move the logic with `typeToNamespacesMap` to here.
const typeToNamespacesMap: any = {};
...
...
}
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
@cliu123 I updated this to:
The else in this clause scopes the request not explicitly containing |
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
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 With the changes in this PR, the Saved Object table does not aggregate saved objects. It only shows the saved objects in the selected tenant.
@cliu123 This PR in OSD Core needs to be merged first: opensearch-project/OpenSearch-Dashboards#2696 The old behavior would send an empty array to signal to the This PR has been updated to treat lack of namespaces (undefined, null or empty array of This will help with the issue of determining which page a request comes from. Since this change targets the |
Signed-off-by: Chang Liu <[email protected]>
Signed-off-by: Chang Liu <[email protected]>
Removing the backport labels for now and will add them back after backporting #1146 |
@cwperks UTs and ITs failed. Could you please check? |
Signed-off-by: Chang Liu <[email protected]>
@cliu123 re-ran UT and IT and they are passing now. The failures were on flaky tests. |
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.
Let's hold off the merge on this PR till merging the other one moving the utils. There could be some conflicts that need to be resolved on this one.
Signed-off-by: Craig Perkins <[email protected]>
c5a3a0f
Signed-off-by: Craig Perkins <[email protected]>
…filter (opensearch-project#1169) Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Chang Liu <[email protected]> Co-authored-by: Chang Liu <[email protected]> Co-authored-by: Darshit Chanpura <[email protected]> (cherry picked from commit 24807bb)
…filter (opensearch-project#1169) Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Chang Liu <[email protected]> Co-authored-by: Chang Liu <[email protected]> Co-authored-by: Darshit Chanpura <[email protected]> (cherry picked from commit 24807bb)
* Saved Object Aggregation View (#1146) * Move tenant-related utils to common folder (#1184) * [Saved Object Aggregation View] Use namespace registry to add tenant filter (#1169) Signed-off-by: Chang Liu <[email protected]> Signed-off-by: Ryan Liang <[email protected]> Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Yan Zeng <[email protected]> Co-authored-by: Ryan Liang <[email protected]> Co-authored-by: Ryan Liang <[email protected]> Co-authored-by: Craig Perkins <[email protected]> Co-authored-by: Yan Zeng <[email protected]>
* Saved Object Aggregation View (#1146) * Move tenant-related utils to common folder (#1184) * [Saved Object Aggregation View] Use namespace registry to add tenant filter (#1169) Signed-off-by: Chang Liu <[email protected]> Signed-off-by: Ryan Liang <[email protected]> Signed-off-by: Craig Perkins <[email protected]> Signed-off-by: Yan Zeng <[email protected]> Co-authored-by: Ryan Liang <[email protected]> Co-authored-by: Ryan Liang <[email protected]> Co-authored-by: Craig Perkins <[email protected]> Co-authored-by: Yan Zeng <[email protected]>
Signed-off-by: Craig Perkins [email protected]
Description
Corresponding PR in OSD: opensearch-project/OpenSearch-Dashboards#2656
This PR uses the new namespace filter to add a tenant filter on the Saved Objects screen of OSD if the saved object aggregation view flag is enabled.
This PR also addresses logic on the
typeToNamespacesMap
to only include type forconfig
when all namespaces are requested or the current tenant is in the list of requested namespaces.Opening this as a Draft until corresponding PR is merged.
Category
[Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation]
Enhancement
Why these changes are required?
What is the old behavior before changes and new behavior after changes?
Issues Resolved
The first milestone of opensearch-project/security#1869.
Testing
Manual UI testing with many scenarios:
Unit Tests
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.