mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
## Summary Fixes https://github.com/elastic/kibana/issues/149132 This PR adds a Kibana feature for the guided onboarding plugin for better permissions handling. By default `kibana_admin` and `editor` roles are granted access to guided onboarding. The role `viewer` on the other hand doesn't have enough permissions to see or use guided onboarding. For any roles that don't have the correct permissions, guided onboarding is completely disabled, the same as it's disabled on-prem. When creating a new role, the feature "Setup guides" can be enabled or disabled. ### How to test 1. Add `xpack.cloud.id: 'testID'` to `/config/kibana.dev.yml` 1. Start ES with `yarn es snapshot` and Kibana with `yarn start`` 2. Login as elastic and create a test user with the role `viewer` 3. Clear everything from your browser's local storage 4. Login as the test user and check the following - On the first visit, the "on-prem" welcome message is shown (not the guided onboarding landing page) - The url `/app/home#/getting_started` is unknown and redirects back to the home page - There is no button "Setup guides" in the header - There is no link "Setup guides" in the help menu ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
97 lines
3.3 KiB
TypeScript
Executable file
97 lines
3.3 KiB
TypeScript
Executable file
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
* Side Public License, v 1.
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { FormattedMessage, I18nProvider } from '@kbn/i18n-react';
|
|
import { Router, Switch } from 'react-router-dom';
|
|
import { Route } from '@kbn/shared-ux-router';
|
|
|
|
import { EuiPageTemplate } from '@elastic/eui';
|
|
|
|
import { CoreStart, ScopedHistory } from '@kbn/core/public';
|
|
|
|
import { GuidedOnboardingPluginStart } from '@kbn/guided-onboarding-plugin/public/types';
|
|
import { StepTwo } from './step_two';
|
|
import { StepOne } from './step_one';
|
|
import { StepThree } from './step_three';
|
|
import { StepFour } from './step_four';
|
|
import { Main } from './main';
|
|
|
|
interface GuidedOnboardingExampleAppDeps {
|
|
notifications: CoreStart['notifications'];
|
|
guidedOnboarding: GuidedOnboardingPluginStart;
|
|
history: ScopedHistory;
|
|
}
|
|
|
|
export const GuidedOnboardingExampleApp = (props: GuidedOnboardingExampleAppDeps) => {
|
|
const { notifications, guidedOnboarding, history } = props;
|
|
|
|
return (
|
|
<I18nProvider>
|
|
<EuiPageTemplate restrictWidth={true} panelled={true}>
|
|
<EuiPageTemplate.Header
|
|
pageTitle={
|
|
<FormattedMessage
|
|
id="guidedOnboardingExample.title"
|
|
defaultMessage="Guided onboarding examples"
|
|
/>
|
|
}
|
|
/>
|
|
{guidedOnboarding.guidedOnboardingApi?.isEnabled ? (
|
|
<EuiPageTemplate.Section>
|
|
<Router history={history}>
|
|
<Switch>
|
|
<Route exact path="/">
|
|
<Main notifications={notifications} guidedOnboarding={guidedOnboarding} />
|
|
</Route>
|
|
<Route exact path="/stepOne">
|
|
<StepOne guidedOnboarding={guidedOnboarding} />
|
|
</Route>
|
|
<Route exact path="/stepTwo">
|
|
<StepTwo />
|
|
</Route>
|
|
<Route exact path="/stepThree">
|
|
<StepThree guidedOnboarding={guidedOnboarding} />
|
|
</Route>
|
|
p
|
|
<Route
|
|
path="/stepFour/:indexName?"
|
|
render={(routeProps) => (
|
|
<StepFour guidedOnboarding={guidedOnboarding} {...routeProps} />
|
|
)}
|
|
/>
|
|
</Switch>
|
|
</Router>
|
|
</EuiPageTemplate.Section>
|
|
) : (
|
|
<EuiPageTemplate.EmptyPrompt
|
|
iconType="error"
|
|
color="danger"
|
|
title={
|
|
<h2>
|
|
<FormattedMessage
|
|
id="guidedOnboardingExample.errorTitle"
|
|
defaultMessage="Guided onboarding is disabled"
|
|
/>
|
|
</h2>
|
|
}
|
|
body={
|
|
<p>
|
|
<FormattedMessage
|
|
id="guidedOnboardingExample.errorDescription"
|
|
defaultMessage="Make sure your Kibana instance runs on Cloud and/or
|
|
your user has access to Setup guides feature."
|
|
/>
|
|
</p>
|
|
}
|
|
/>
|
|
)}
|
|
</EuiPageTemplate>
|
|
</I18nProvider>
|
|
);
|
|
};
|