diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.test.tsx index e088678a13562..4b3283a866910 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.test.tsx @@ -292,7 +292,10 @@ describe('useEngineNav', () => { }); it('returns a Search UI nav item', () => { - setMockValues({ ...values, myRole: { canManageEngineSearchUi: true } }); + setMockValues({ + ...values, + myRole: { canManageEngineSearchUi: true, canViewAccountCredentials: true }, + }); expect(useEngineNav()).toEqual([ ...BASE_NAV, { diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.tsx index 70f2d04a5123d..b60a39dbad48d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_nav.tsx @@ -50,6 +50,7 @@ export const useEngineNav = () => { const isEngineRoute = !!useRouteMatch(ENGINE_PATH); const { myRole: { + canViewAccountCredentials, canViewEngineAnalytics, canViewEngineDocuments, canViewEngineSchema, @@ -275,7 +276,11 @@ export const useEngineNav = () => { }); } - if (canManageEngineSearchUi) { + /* TODO: In 8.0, this should change to just canManageEngineSearchUi and access to Search UI should be removed from + the Editor role. As of 7.14, we are hiding this page from Editors this way to stay backward compatible with ent-search, + where Editors should still have access. Editors technically have access to this page but do not have access to + credentials, which are required for the page to work. */ + if (canManageEngineSearchUi && canViewAccountCredentials) { navItems.push({ id: 'searchUI', name: SEARCH_UI_TITLE, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.test.tsx index ed35bfbe97842..3846c8a40e884 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.test.tsx @@ -168,7 +168,10 @@ describe('EngineRouter', () => { }); it('renders a search ui view', () => { - setMockValues({ ...values, myRole: { canManageEngineSearchUi: true } }); + setMockValues({ + ...values, + myRole: { canManageEngineSearchUi: true, canViewAccountCredentials: true }, + }); const wrapper = shallow(); expect(wrapper.find(SearchUI)).toHaveLength(1); diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.tsx b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.tsx index 2d1bd32a0fff5..21ae0b68a3ba9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engine/engine_router.tsx @@ -51,6 +51,7 @@ import { EngineLogic, getEngineBreadcrumbs } from './'; export const EngineRouter: React.FC = () => { const { myRole: { + canViewAccountCredentials, canViewEngineAnalytics, canViewEngineDocuments, canViewEngineSchema, @@ -150,7 +151,11 @@ export const EngineRouter: React.FC = () => { )} - {canManageEngineSearchUi && ( + {/* TODO: In 8.0, this should change to just canManageEngineSearchUi and access to Search UI should be removed from + the Editor role. As of 7.14, we are hiding this page from Editors this way to stay backward compatible with ent-search, + where Editors should still have access. Editors technically have access to this page but do not have access to + credentials, which are required for the page to work. */} + {canManageEngineSearchUi && canViewAccountCredentials && (