kibana/x-pack/plugins/canvas/server/feature.ts
Tim Sullivan 5a6eda2b22
[Reporting] Kibana Application Privileges for Reporting (#94966)
* Implement Reporting features as subfeatures of applications

* add setting to the docker list

* update doc images

* finish docs

* Apply suggestions from code review

Co-authored-by: Kaarina Tungseth <kaarina.tungseth@elastic.co>

* Apply suggestions from code review

Co-authored-by: Kaarina Tungseth <kaarina.tungseth@elastic.co>

* Apply suggestions from code review

Co-authored-by: Kaarina Tungseth <kaarina.tungseth@elastic.co>

* typo fix

* "PDF / PNG Reports" => "Reporting"

* Update x-pack/plugins/reporting/server/config/index.ts

Co-authored-by: Larry Gregory <lgregorydev@gmail.com>

* Update x-pack/test/functional/apps/security/secure_roles_perm.js

Co-authored-by: Larry Gregory <lgregorydev@gmail.com>

* update ids of report privileges

* combine dashboard privileges into 1 group

* update jest snapshot

* fix tests

* fix tests

* updates from feedback

* add note

* update screenshot

* fix grammer

* fix bad link breaks in doc

* update doc heading

* Apply suggestions documentation feedback

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* simplify

* use const assertions

* Apply text change suggestion from code review

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>

* more test for oss_features and reporting subFeatures

* reduce loc diff

* fix snapshot

* fix flakiness in licensing plugin public functional tests

Co-authored-by: Kaarina Tungseth <kaarina.tungseth@elastic.co>
Co-authored-by: Larry Gregory <lgregorydev@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
2021-04-20 20:44:24 -07:00

82 lines
2.5 KiB
TypeScript

/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { i18n } from '@kbn/i18n';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
import { KibanaFeatureConfig } from '../../features/common';
import { ReportingSetup } from '../../reporting/server';
/*
* Register Canvas as a Kibana feature,
* with Reporting sub-feature integration (if enabled)
*/
export function getCanvasFeature(plugins: { reporting?: ReportingSetup }): KibanaFeatureConfig {
const includeReporting = plugins.reporting && plugins.reporting.usesUiCapabilities();
return {
id: 'canvas',
name: 'Canvas',
order: 300,
category: DEFAULT_APP_CATEGORIES.kibana,
app: ['canvas', 'kibana'],
management: {
...(includeReporting ? { insightsAndAlerting: ['reporting'] } : {}),
},
catalogue: ['canvas'],
privileges: {
all: {
app: ['canvas', 'kibana'],
catalogue: ['canvas'],
savedObject: {
all: ['canvas-workpad', 'canvas-element'],
read: ['index-pattern'],
},
ui: ['save', 'show'],
},
read: {
app: ['canvas', 'kibana'],
catalogue: ['canvas'],
savedObject: {
all: [],
read: ['index-pattern', 'canvas-workpad', 'canvas-element'],
},
ui: ['show'],
},
},
subFeatures: [
...(includeReporting
? ([
{
name: i18n.translate('xpack.canvas.features.reporting.pdfFeatureName', {
defaultMessage: 'Reporting',
}),
privilegeGroups: [
{
groupType: 'independent',
privileges: [
{
id: 'generate_report',
name: i18n.translate('xpack.canvas.features.reporting.pdf', {
defaultMessage: 'Generate PDF reports',
}),
includeIn: 'all',
management: { insightsAndAlerting: ['reporting'] },
minimumLicense: 'platinum',
savedObject: { all: [], read: [] },
api: ['generateReport'],
ui: ['generatePdf'],
},
],
},
],
},
] as const)
: []),
],
};
}