Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const useEngineNav = () => {
const isEngineRoute = !!useRouteMatch(ENGINE_PATH);
const {
myRole: {
canViewAccountCredentials,
canViewEngineAnalytics,
canViewEngineDocuments,
canViewEngineSchema,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(<EngineRouter />);

expect(wrapper.find(SearchUI)).toHaveLength(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import { EngineLogic, getEngineBreadcrumbs } from './';
export const EngineRouter: React.FC = () => {
const {
myRole: {
canViewAccountCredentials,
canViewEngineAnalytics,
canViewEngineDocuments,
canViewEngineSchema,
Expand Down Expand Up @@ -150,7 +151,11 @@ export const EngineRouter: React.FC = () => {
<ResultSettings />
</Route>
)}
{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 && (
<Route path={ENGINE_SEARCH_UI_PATH}>
<SearchUI />
</Route>
Expand Down