forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cases] [Security Solution] New cases subfeatures, add comments and r…
…eopen cases (elastic#194898) ## Summary This pr adds 2 new sub feature permissions to the cases plugin in stack/security/observability, that behave as follows. The first is for controlling the ability to reopen cases. When Cases has the read permission, and the reopen permission is not enabled, users have permissions as before. When enabled, users can move cases from closed to open/in progress, but nothing else. If a user has all and this permission, they can do anything as before, if the option is unselected, they can change case properties, and change a case from open to anything, in progress to anything, but if the case is closed, are unable to reopen it. The 2nd permission is 'Add comment'. When enabled and the user has case read permissions, users can add comments, but not make any other changes to the case. When the user has read and this deselected, read functions as before. When a user has this permission and cases is all, this functions as all. When they have all but this permission is deselected, the user can do everything normally, except add cases comments. ### 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) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [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: Michael Olorunnisola <[email protected]> Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
41840e6
commit a3f1697
Showing
145 changed files
with
3,541 additions
and
516 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
98 changes: 98 additions & 0 deletions
98
x-pack/packages/security-solution/features/src/cases/v1_features/kibana_features.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* 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 '@kbn/core-application-common'; | ||
import { KibanaFeatureScope } from '@kbn/features-plugin/common'; | ||
import type { BaseKibanaFeatureConfig } from '../../types'; | ||
import { APP_ID, CASES_FEATURE_ID, CASES_FEATURE_ID_V2 } from '../../constants'; | ||
import type { CasesFeatureParams } from '../types'; | ||
|
||
/** | ||
* @deprecated Use getCasesBaseKibanaFeatureV2 instead | ||
*/ | ||
export const getCasesBaseKibanaFeature = ({ | ||
uiCapabilities, | ||
apiTags, | ||
savedObjects, | ||
}: CasesFeatureParams): BaseKibanaFeatureConfig => { | ||
return { | ||
deprecated: { | ||
notice: i18n.translate( | ||
'securitySolutionPackages.features.featureRegistry.linkSecuritySolutionCase.deprecationMessage', | ||
{ | ||
defaultMessage: | ||
'The {currentId} permissions are deprecated, please see {casesFeatureIdV2}.', | ||
values: { | ||
currentId: CASES_FEATURE_ID, | ||
casesFeatureIdV2: CASES_FEATURE_ID_V2, | ||
}, | ||
} | ||
), | ||
}, | ||
id: CASES_FEATURE_ID, | ||
name: i18n.translate( | ||
'securitySolutionPackages.features.featureRegistry.linkSecuritySolutionCaseTitleDeprecated', | ||
{ | ||
defaultMessage: 'Cases (Deprecated)', | ||
} | ||
), | ||
order: 1100, | ||
category: DEFAULT_APP_CATEGORIES.security, | ||
scope: [KibanaFeatureScope.Spaces, KibanaFeatureScope.Security], | ||
app: [CASES_FEATURE_ID, 'kibana'], | ||
catalogue: [APP_ID], | ||
cases: [APP_ID], | ||
privileges: { | ||
all: { | ||
api: [...apiTags.all, ...apiTags.createComment], | ||
app: [CASES_FEATURE_ID, 'kibana'], | ||
catalogue: [APP_ID], | ||
cases: { | ||
create: [APP_ID], | ||
read: [APP_ID], | ||
update: [APP_ID], | ||
push: [APP_ID], | ||
createComment: [APP_ID], | ||
reopenCase: [APP_ID], | ||
}, | ||
savedObject: { | ||
all: [...savedObjects.files], | ||
read: [...savedObjects.files], | ||
}, | ||
ui: uiCapabilities.all, | ||
replacedBy: { | ||
default: [{ feature: CASES_FEATURE_ID_V2, privileges: ['all'] }], | ||
minimal: [ | ||
{ | ||
feature: CASES_FEATURE_ID_V2, | ||
privileges: ['minimal_all', 'create_comment', 'case_reopen'], | ||
}, | ||
], | ||
}, | ||
}, | ||
read: { | ||
api: apiTags.read, | ||
app: [CASES_FEATURE_ID, 'kibana'], | ||
catalogue: [APP_ID], | ||
cases: { | ||
read: [APP_ID], | ||
}, | ||
savedObject: { | ||
all: [], | ||
read: [...savedObjects.files], | ||
}, | ||
ui: uiCapabilities.read, | ||
replacedBy: { | ||
default: [{ feature: CASES_FEATURE_ID_V2, privileges: ['read'] }], | ||
minimal: [{ feature: CASES_FEATURE_ID_V2, privileges: ['minimal_read'] }], | ||
}, | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains 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
14 changes: 14 additions & 0 deletions
14
x-pack/packages/security-solution/features/src/cases/v1_features/types.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* 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 type { ProductFeatureCasesKey, CasesSubFeatureId } from '../../product_features_keys'; | ||
import type { ProductFeatureKibanaConfig } from '../../types'; | ||
|
||
export type DefaultCasesProductFeaturesConfig = Record< | ||
ProductFeatureCasesKey, | ||
ProductFeatureKibanaConfig<CasesSubFeatureId> | ||
>; |
Oops, something went wrong.