Skip to content

Commit

Permalink
Cleanup alerting / actions feature controls (#52286)
Browse files Browse the repository at this point in the history
* Initial work

* Apply changes based on feedback

* Fix a broken test

* Fix failing test

* Revert monitoring changes

* Remove UI features for now
  • Loading branch information
mikecote authored Dec 13, 2019
1 parent 81a30d9 commit 88ae8d0
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 56 deletions.
24 changes: 0 additions & 24 deletions x-pack/legacy/plugins/actions/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,6 @@ export class Plugin {
this.adminClient = await core.elasticsearch.adminClient$.pipe(first()).toPromise();
this.defaultKibanaIndex = (await this.kibana$.pipe(first()).toPromise()).index;

plugins.xpack_main.registerFeature({
id: 'actions',
name: 'Actions',
app: ['actions', 'kibana'],
privileges: {
all: {
savedObject: {
all: ['action', 'action_task_params'],
read: [],
},
ui: [],
api: ['actions-read', 'actions-all'],
},
read: {
savedObject: {
all: ['action_task_params'],
read: ['action'],
},
ui: [],
api: ['actions-read'],
},
},
});

// Encrypted attributes
// - `secrets` properties will be encrypted
// - `config` will be included in AAD
Expand Down
24 changes: 0 additions & 24 deletions x-pack/legacy/plugins/alerting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,6 @@ export class Plugin {
): Promise<PluginSetupContract> {
this.adminClient = await core.elasticsearch.adminClient$.pipe(first()).toPromise();

plugins.xpack_main.registerFeature({
id: 'alerting',
name: 'Alerting',
app: ['alerting', 'kibana'],
privileges: {
all: {
savedObject: {
all: ['alert'],
read: [],
},
ui: [],
api: ['alerting-read', 'alerting-all'],
},
read: {
savedObject: {
all: [],
read: ['alert'],
},
ui: [],
api: ['alerting-read'],
},
},
});

// Encrypted attributes
plugins.encryptedSavedObjects.registerType({
type: 'alert',
Expand Down
15 changes: 11 additions & 4 deletions x-pack/legacy/plugins/siem/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,24 @@ export class Plugin {
catalogue: ['siem'],
privileges: {
all: {
api: ['siem'],
api: ['siem', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
savedObject: {
all: [noteSavedObjectType, pinnedEventSavedObjectType, timelineSavedObjectType],
all: [
'alert',
'action',
'action_task_params',
noteSavedObjectType,
pinnedEventSavedObjectType,
timelineSavedObjectType,
],
read: ['config'],
},
ui: ['show'],
},
read: {
api: ['siem'],
api: ['siem', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
savedObject: {
all: [],
all: ['alert', 'action', 'action_task_params'],
read: [
'config',
noteSavedObjectType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,30 @@ export default function(kibana: any) {
require: ['actions'],
name: NAME,
init: (server: Hapi.Server) => {
server.plugins.xpack_main.registerFeature({
id: 'actions',
name: 'Actions',
app: ['actions', 'kibana'],
privileges: {
all: {
savedObject: {
all: ['action', 'action_task_params'],
read: [],
},
ui: [],
api: ['actions-read', 'actions-all'],
},
read: {
savedObject: {
all: ['action_task_params'],
read: ['action'],
},
ui: [],
api: ['actions-read'],
},
},
});

initSlack(server, getExternalServiceSimulatorPath(ExternalServiceSimulator.SLACK));
initWebhook(server, getExternalServiceSimulatorPath(ExternalServiceSimulator.WEBHOOK));
initPagerduty(server, getExternalServiceSimulatorPath(ExternalServiceSimulator.PAGERDUTY));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ export default function(kibana: any) {
require: ['actions', 'alerting', 'elasticsearch'],
name: 'alerts',
init(server: any) {
server.plugins.xpack_main.registerFeature({
id: 'alerting',
name: 'Alerting',
app: ['alerting', 'kibana'],
privileges: {
all: {
savedObject: {
all: ['alert'],
read: [],
},
ui: [],
api: ['alerting-read', 'alerting-all'],
},
read: {
savedObject: {
all: [],
read: ['alert'],
},
ui: [],
api: ['alerting-read'],
},
},
});

// Action types
const noopActionType: ActionType = {
id: 'test.noop',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ export default function({ getService }: FtrProviderContext) {
'maps',
'uptime',
'siem',
'alerting',
'actions',
].sort()
);
});
Expand Down
2 changes: 0 additions & 2 deletions x-pack/test/api_integration/apis/security/privileges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ export default function({ getService }: FtrProviderContext) {
uptime: ['all', 'read'],
apm: ['all', 'read'],
siem: ['all', 'read'],
actions: ['all', 'read'],
alerting: ['all', 'read'],
},
global: ['all', 'read'],
space: ['all', 'read'],
Expand Down

0 comments on commit 88ae8d0

Please sign in to comment.