Skip to content

Commit fe770b9

Browse files
ApiV1(*)Controller: Provide permission and add Routes
1 parent 9faad19 commit fe770b9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

configuration.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
$this->translate('Allow to configure contact groups')
4141
);
4242

43+
$this->providePermission(
44+
'notifications/api/v1',
45+
$this->translate('Allow to add and modify contacts and contactgroups via API')
46+
);
47+
4348
$this->provideRestriction(
4449
'notifications/filter/objects',
4550
$this->translate('Restrict access to the objects that match the filter')

run.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,29 @@
55
/** @var $this \Icinga\Application\Modules\Module */
66

77
$this->provideHook('Notifications/ObjectsRenderer');
8+
9+
$this->addRoute('notifications/api-v1-contacts', new Zend_Controller_Router_Route_Regex(
10+
'notifications/api/v1/contacts(?:\/(.+)|\?(.+))?',
11+
[
12+
'controller' => 'api-v1-contacts',
13+
'action' => 'index',
14+
'module' => 'notifications',
15+
'identifier' => null
16+
],
17+
[
18+
1 => 'identifier'
19+
]
20+
));
21+
22+
$this->addRoute('notifications/api-v1-contactgroups', new Zend_Controller_Router_Route_Regex(
23+
'notifications/api/v1/contactgroups(?:\/(.+)|\?(.+))?',
24+
[
25+
'controller' => 'api-v1-contactgroups',
26+
'action' => 'index',
27+
'module' => 'notifications',
28+
'identifier' => null
29+
],
30+
[
31+
1 => 'identifier'
32+
]
33+
));

0 commit comments

Comments
 (0)