Skip to content

Commit daf35f9

Browse files
committed
[Alerting] add alerting privileges for uptime and metrics
resolves #60135 See the reference issue for how to configure Kibana to test this manually. There are no automated tests for this ATM. The basic test scenario is to create a role with just the Uptime space privilege, make sure it get to the Alerts and Actions management app, make sure you can create an action (server log), and alert (index threshold), and that the alert and action run successfully. Then repeat with just the Metrics space privilege.
1 parent b0eb798 commit daf35f9

File tree

3 files changed

+56
-13
lines changed

3 files changed

+56
-13
lines changed

x-pack/plugins/infra/server/features.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,40 @@ export const METRICS_FEATURE = {
2020
all: {
2121
app: ['infra', 'kibana'],
2222
catalogue: ['infraops'],
23-
api: ['infra'],
23+
api: ['infra', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
2424
savedObject: {
25-
all: ['infrastructure-ui-source'],
25+
all: ['infrastructure-ui-source', 'alert', 'action', 'action_task_params'],
2626
read: ['index-pattern'],
2727
},
28-
ui: ['show', 'configureSource', 'save'],
28+
ui: [
29+
'show',
30+
'configureSource',
31+
'save',
32+
'alerting:show',
33+
'actions:show',
34+
'alerting:save',
35+
'actions:save',
36+
'alerting:delete',
37+
'actions:delete',
38+
],
2939
},
3040
read: {
3141
app: ['infra', 'kibana'],
3242
catalogue: ['infraops'],
33-
api: ['infra'],
43+
api: ['infra', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
3444
savedObject: {
35-
all: [],
45+
all: ['alert', 'action', 'action_task_params'],
3646
read: ['infrastructure-ui-source', 'index-pattern'],
3747
},
38-
ui: ['show'],
48+
ui: [
49+
'show',
50+
'alerting:show',
51+
'actions:show',
52+
'alerting:save',
53+
'actions:save',
54+
'alerting:delete',
55+
'actions:delete',
56+
],
3957
},
4058
},
4159
};

x-pack/plugins/triggers_actions_ui/public/application/lib/capabilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
type Capabilities = Record<string, any>;
1414

15-
const apps = ['apm', 'siem'];
15+
const apps = ['apm', 'siem', 'uptime', 'infrastructure'];
1616

1717
function hasCapability(capabilities: Capabilities, capability: string) {
1818
return apps.some(app => capabilities[app]?.[capability]);

x-pack/plugins/uptime/server/kibana.index.ts

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,47 @@ export const initServerWithKibana = (server: UptimeCoreSetup, plugins: UptimeCor
4141
all: {
4242
app: ['uptime', 'kibana'],
4343
catalogue: ['uptime'],
44-
api: ['uptime-read', 'uptime-write'],
44+
api: [
45+
'uptime-read',
46+
'uptime-write',
47+
'actions-read',
48+
'actions-all',
49+
'alerting-read',
50+
'alerting-all',
51+
],
4552
savedObject: {
46-
all: [umDynamicSettings.name],
53+
all: [umDynamicSettings.name, 'alert', 'action', 'action_task_params'],
4754
read: [],
4855
},
49-
ui: ['save', 'configureSettings', 'show'],
56+
ui: [
57+
'save',
58+
'configureSettings',
59+
'show',
60+
'alerting:show',
61+
'actions:show',
62+
'alerting:save',
63+
'actions:save',
64+
'alerting:delete',
65+
'actions:delete',
66+
],
5067
},
5168
read: {
5269
app: ['uptime', 'kibana'],
5370
catalogue: ['uptime'],
54-
api: ['uptime-read'],
71+
api: ['uptime-read', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
5572
savedObject: {
56-
all: [],
73+
all: ['alert', 'action', 'action_task_params'],
5774
read: [umDynamicSettings.name],
5875
},
59-
ui: ['show'],
76+
ui: [
77+
'show',
78+
'alerting:show',
79+
'actions:show',
80+
'alerting:save',
81+
'actions:save',
82+
'alerting:delete',
83+
'actions:delete',
84+
],
6085
},
6186
},
6287
});

0 commit comments

Comments
 (0)