-
Notifications
You must be signed in to change notification settings - Fork 892
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
[DataSource] Restrict to manage data source on the DSM UI #7214
[DataSource] Restrict to manage data source on the DSM UI #7214
Conversation
Signed-off-by: yubonluo <yubonluo@amazon.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7214 +/- ##
==========================================
- Coverage 67.32% 67.32% -0.01%
==========================================
Files 3500 3500
Lines 69225 69232 +7
Branches 11276 11282 +6
==========================================
+ Hits 46604 46608 +4
- Misses 19895 19896 +1
- Partials 2726 2728 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: yubonluo <yubonluo@amazon.com>
…oards into 2.16-restrict-data-source
…earch-Dashboards into 2.16-restrict-data-source
Signed-off-by: yubonluo <yubonluo@amazon.com>
…oards into 2.16-restrict-data-source
Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: yubonluo <yubonluo@amazon.com>
core.capabilities.registerSwitcher((request) => { | ||
const { requestWorkspaceId, isDashboardAdmin } = getWorkspaceState(request); | ||
// User can not manage data source in the workspace. | ||
const canManage = | ||
(manageableBy === ManageableBy.All && !requestWorkspaceId) || | ||
(manageableBy === ManageableBy.DashboardAdmin && | ||
isDashboardAdmin !== false && | ||
!requestWorkspaceId); | ||
|
||
return { dataSource: { canManage } }; | ||
}); |
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.
Should we move this switcher to workspace?
{canManageDataSource ? ( | ||
<EuiFlexItem grow={false}>{renderDefaultIcon()}</EuiFlexItem> | ||
) : null} |
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.
Should we restrict user from setting default data source? @ruanyl
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-7214-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 41900a0b3eff6b52c250b76d4ca316c141206a6c
# Push it to GitHub
git push --set-upstream origin backport/backport-7214-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-7214-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 41900a0b3eff6b52c250b76d4ca316c141206a6c
# Push it to GitHub
git push --set-upstream origin backport/backport-7214-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
Description
Restrict to edit data source on the DSM UI.
manageableBy:
Issues Resolved
#6889
Screenshot
manageableBy="all" or
manageableBy="dashboard_admin" and user is OSD admin
manageableBy="none" or
manageableBy="dashboard_admin" and user is not OSD admin or
user in a workspace
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration