-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP API to configure contacts and contactgroups #199
base: main
Are you sure you want to change the base?
Conversation
76e2d45
to
9034db3
Compare
c83e47b
to
1879b41
Compare
In case of POST method, if the optional field "groups" is used for contacts or "users" for contactgroups, you get 500 (Internal Server Error) response code, with following exception:
Example request:
Edit: This is also the case for PUT method. Additionally, in PUT method the update of contactgroups is failing, even if you are updating the name. |
3aa2588
to
1b88cc9
Compare
In case of PUT method, update is resulting in response code 500 (Internal Server Error), with the following exception:
Also, I think external_uuid column must be unique. I have commented about this already in Icinga/icinga-notifications#216. If it is not unique with POST method you can inject many contacts or contact groups with same external_uuid. |
No, the |
I identified that external_uuid is not unique after I could inject a duplicate through POST method. Anyways, after making the column unique the problem will be solved. |
016bc46
to
7187db3
Compare
7187db3
to
683b2a7
Compare
8c45754
to
621cb99
Compare
ad4af75
to
5e77418
Compare
5e77418
to
2913e31
Compare
I just noticed how bad the idea was to reference channels by their name: The names of channels are not unique.
So I think we should also introduce UUIDs for them. It may be incomplete for sure, but adding all API endpoints for them is out of scope right now, the |
2efafbf
to
cc77780
Compare
8453e00
to
93c9343
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't review the controller code yet, but have tested it, at least the one for contact groups. Let's look together over the results tomorrow.
application/forms/ChannelForm.php
Outdated
@@ -189,6 +190,7 @@ function ($configItem, $key) { | |||
); | |||
|
|||
$channel['config'] = json_encode($config); | |||
$channel['external_uuid'] = Uuid::uuid4()->toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only for inserts
configuration.php
Outdated
@@ -42,6 +42,11 @@ | |||
$this->translate('Allow to configure contact groups') | |||
); | |||
|
|||
$this->providePermission( | |||
'notifications/api/v1', | |||
$this->translate('Allow to add and modify contacts and contactgroups via API') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add and modify contacts and contactgroupsmodify configuration
library/Notifications/Web/Control/SearchBar/ObjectSuggestions.php
Outdated
Show resolved
Hide resolved
93c9343
to
7787168
Compare
7787168
to
b141b41
Compare
…nsert Contactgroup: Don't trim groupname, as we donot do this in any other form.
Only show this column in the search column suggestions if explicitly specified Contact: Remove `changed_at` from column definations, as this should not be searchable.
Return the default empty data type instead
As the channel names are not unique, uuid should be used in GET responses
Leave this to QueryString::fromString() method.
b141b41
to
d83ab13
Compare
resolves #176
Requires:
external_uuid
tocontact/contactgroup
table icinga-notifications#216On_ASSEMBLE_INSERT / ON_ASSEMBLE_UPDATE
events handle thechanged_at
column #227