wip - #8302
Draft
esvm wants to merge 2 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an Atlas-role-derived enableIndexesManagement preference intended to allow “Index Manager” users to manage regular indexes in Compass-Web even when broader write/admin UI is restricted via readOnly / readWrite. The approach is generally cohesive (plumbed through selectors and covered by tests), but there are a couple of permission-default and UI-gating issues that should be addressed before merge.
Changes:
- Add
enableIndexesManagementpreference derived from Atlas roles in Compass-Web and model it in the preferences schema. - Allow regular index write actions when
enableIndexesManagementis true, while keeping search-index write access unchanged. - Extend unit/integration tests around the new permission behavior.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/compass-web/src/preferences.tsx | Derives enableIndexesManagement from Atlas roles when building cloud preferences. |
| packages/compass-web/src/preferences.spec.tsx | Adds coverage for index-management permission derivation scenarios. |
| packages/compass-preferences-model/src/preferences-schema.tsx | Introduces enableIndexesManagement into the preferences schema/types. |
| packages/compass-indexes/src/utils/indexes-read-write-access.ts | Updates access selector to allow regular index writes when index-management is enabled. |
| packages/compass-indexes/src/utils/indexes-read-write-access.spec.ts | Adds test cases for index-management behavior. |
| packages/compass-indexes/src/modules/search-indexes.ts | Threads new preference through selector usage. |
| packages/compass-indexes/src/modules/regular-indexes.ts | Threads new preference through selector usage. |
| packages/compass-indexes/src/components/search-indexes-table/search-indexes-table.tsx | Passes enableIndexesManagement into access selector. |
| packages/compass-indexes/src/components/search-indexes-table/search-indexes-drawer-table.tsx | Passes enableIndexesManagement into access selector. |
| packages/compass-indexes/src/components/regular-indexes-table/regular-indexes-table.tsx | Passes enableIndexesManagement into access selector for regular indexes. |
| packages/compass-indexes/src/components/regular-indexes-table/regular-indexes-table.spec.tsx | Adds UI coverage for action visibility with index-management enabled/disabled. |
| packages/compass-indexes/src/components/regular-indexes-table/regular-indexes-drawer-table.tsx | Passes enableIndexesManagement into access selector for drawer view. |
| packages/compass-indexes/src/components/indexes/indexes.tsx | Passes enableIndexesManagement into access selector for overall indexes view gating. |
| packages/compass-indexes/src/components/indexes-toolbar/indexes-toolbar.tsx | Updates create-index button gating to consider index-management permission. |
| packages/compass-indexes/src/components/indexes-toolbar/indexes-toolbar.spec.tsx | Adds coverage for create-index button visibility when index-management is enabled. |
| packages/compass-indexes/src/components/drawer-views/indexes-list-drawer-view.tsx | Passes enableIndexesManagement into access selector. |
| packages/compass-indexes/src/components/drawer-views/edit-search-index-drawer-view.tsx | Passes enableIndexesManagement into access selector. |
| packages/compass-indexes/src/components/drawer-views/create-search-index-drawer-view.tsx | Passes enableIndexesManagement into access selector. |
Comment on lines
+28
to
30
| const enableIndexesManagement = | ||
| preferences.enableIndexesManagement ?? true; | ||
| const enableAtlasSearchIndexes = |
Comment on lines
134
to
+138
| (!isReadonlyView || | ||
| VIEW_PIPELINE_UTILS.isVersionSearchCompatibleForViewsCompass( | ||
| serverVersion | ||
| )) && | ||
| !preferencesReadWrite && | ||
| (!preferencesReadWrite || enableIndexesManagement) && |
Comment on lines
+36
to
+39
| // `enableIndexesManagement` allows creating / dropping / hiding indexes even | ||
| // when the user lacks general write access (`readOnly`) or admin-level | ||
| // access (`readWrite`). This matches the Atlas "Index Manager" role, where | ||
| // MongoDB itself authorizes `createIndex` / `dropIndex` for these users. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes