Skip to content

Commit 014ea12

Browse files
authored
[Alerting] add alerting privileges for uptime and metrics (#61113)
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 dc77759 commit 014ea12

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
@@ -39,22 +39,47 @@ export const initServerWithKibana = (server: UptimeCoreSetup, plugins: UptimeCor
3939
all: {
4040
app: ['uptime', 'kibana'],
4141
catalogue: ['uptime'],
42-
api: ['uptime-read', 'uptime-write'],
42+
api: [
43+
'uptime-read',
44+
'uptime-write',
45+
'actions-read',
46+
'actions-all',
47+
'alerting-read',
48+
'alerting-all',
49+
],
4350
savedObject: {
44-
all: [umDynamicSettings.name],
51+
all: [umDynamicSettings.name, 'alert', 'action', 'action_task_params'],
4552
read: [],
4653
},
47-
ui: ['save', 'configureSettings', 'show'],
54+
ui: [
55+
'save',
56+
'configureSettings',
57+
'show',
58+
'alerting:show',
59+
'actions:show',
60+
'alerting:save',
61+
'actions:save',
62+
'alerting:delete',
63+
'actions:delete',
64+
],
4865
},
4966
read: {
5067
app: ['uptime', 'kibana'],
5168
catalogue: ['uptime'],
52-
api: ['uptime-read'],
69+
api: ['uptime-read', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
5370
savedObject: {
54-
all: [],
71+
all: ['alert', 'action', 'action_task_params'],
5572
read: [umDynamicSettings.name],
5673
},
57-
ui: ['show'],
74+
ui: [
75+
'show',
76+
'alerting:show',
77+
'actions:show',
78+
'alerting:save',
79+
'actions:save',
80+
'alerting:delete',
81+
'actions:delete',
82+
],
5883
},
5984
},
6085
});

0 commit comments

Comments
 (0)