Skip to content

Commit

Permalink
Partial pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kqualters-elastic authored and michaelolo24 committed Oct 14, 2024
1 parent b44eff3 commit 10d7756
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/cases/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const PUSH_CASES_CAPABILITY = 'push_cases' as const;
export const CASES_SETTINGS_CAPABILITY = 'cases_settings' as const;
export const CASES_CONNECTORS_CAPABILITY = 'cases_connectors' as const;
export const REOPEN_CASES_CAPABILITY = 'reopen_cases' as const;
export const COMMENT_CASES_CAPABILITY = 'create_comment' as const;
export const CREATE_COMMENT_CAPABILITY = 'create_comment' as const;

/**
* Cases API Tags
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/cases/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export {
CASES_CONNECTORS_CAPABILITY,
GET_CONNECTORS_CONFIGURE_API_TAG,
CASES_SETTINGS_CAPABILITY,
COMMENT_CASES_CAPABILITY,
CREATE_COMMENT_CAPABILITY,
REOPEN_CASES_CAPABILITY,
} from './constants';

Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/cases/common/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
DELETE_CASES_CAPABILITY,
READ_CASES_CAPABILITY,
UPDATE_CASES_CAPABILITY,
COMMENT_CASES_CAPABILITY,
CREATE_COMMENT_CAPABILITY,
REOPEN_CASES_CAPABILITY,
} from '..';
import type {
Expand Down Expand Up @@ -319,6 +319,6 @@ export interface CasesCapabilities {
[PUSH_CASES_CAPABILITY]: boolean;
[CASES_CONNECTORS_CAPABILITY]: boolean;
[CASES_SETTINGS_CAPABILITY]: boolean;
[COMMENT_CASES_CAPABILITY]: boolean;
[CREATE_COMMENT_CAPABILITY]: boolean;
[REOPEN_CASES_CAPABILITY]: boolean;
}
4 changes: 2 additions & 2 deletions x-pack/plugins/cases/common/utils/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
UPDATE_CASES_CAPABILITY,
CASES_SETTINGS_CAPABILITY,
REOPEN_CASES_CAPABILITY,
COMMENT_CASES_CAPABILITY,
CREATE_COMMENT_CAPABILITY,
} from '../constants';

export interface CasesUiCapabilities {
Expand All @@ -41,5 +41,5 @@ export const createUICapabilities = (): CasesUiCapabilities => ({
delete: [DELETE_CASES_CAPABILITY] as const,
settings: [CASES_SETTINGS_CAPABILITY] as const,
reopenCases: [REOPEN_CASES_CAPABILITY] as const,
createComment: [COMMENT_CASES_CAPABILITY] as const,
createComment: [CREATE_COMMENT_CAPABILITY] as const,
});
4 changes: 2 additions & 2 deletions x-pack/plugins/cases/public/client/helpers/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
READ_CASES_CAPABILITY,
UPDATE_CASES_CAPABILITY,
REOPEN_CASES_CAPABILITY,
COMMENT_CASES_CAPABILITY,
CREATE_COMMENT_CAPABILITY,
} from '../../../common/constants';

export const getUICapabilities = (
Expand All @@ -29,7 +29,7 @@ export const getUICapabilities = (
const connectors = !!featureCapabilities?.[CASES_CONNECTORS_CAPABILITY];
const settings = !!featureCapabilities?.[CASES_SETTINGS_CAPABILITY];
const reopenCases = !!featureCapabilities?.[REOPEN_CASES_CAPABILITY];
const createComment = !!featureCapabilities?.[COMMENT_CASES_CAPABILITY];
const createComment = !!featureCapabilities?.[CREATE_COMMENT_CAPABILITY];

const all =
create &&
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/cases/server/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
APP_ID,
FEATURE_ID,
REOPEN_CASES_CAPABILITY,
COMMENT_CASES_CAPABILITY,
CREATE_COMMENT_CAPABILITY,
} from '../common/constants';
import { createUICapabilities, getApiTags } from '../common';

Expand Down Expand Up @@ -144,7 +144,7 @@ export const getCasesKibanaFeature = (): KibanaFeatureConfig => {
privileges: [
{
api: apiTags.all,
id: COMMENT_CASES_CAPABILITY,
id: CREATE_COMMENT_CAPABILITY,
name: i18n.translate('xpack.cases.features.addCommentsSubFeatureDetails', {
defaultMessage: 'Add comments to cases',
}),
Expand Down
18 changes: 18 additions & 0 deletions x-pack/plugins/features/common/feature_kibana_privileges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,25 @@ export interface FeatureKibanaPrivileges {
* ```
*/
settings?: readonly string[];
/**
* List of case owners whose users should have createComment access when granted this privilege.
* @example
* ```ts
* {
* createComment: ['securitySolution']
* }
* ```
*/
createComment?: readonly string[];
/**
* List of case owners whose users should have reopenCases access when granted this privilege.
* @example
* ```ts
* {
* reopenCases: ['securitySolution']
* }
* ```
*/
reopenCases?: readonly string[];
};

Expand Down

0 comments on commit 10d7756

Please sign in to comment.