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

Add add_service_for_host endpoint to API #8113

Merged
merged 2 commits into from Jan 21, 2018

Conversation

Projects
None yet
4 participants
@remyj38
Contributor

remyj38 commented Jan 19, 2018

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

This pull request add the add_service_for_device API endpoint.

@CLAassistant

This comment has been minimized.

CLAassistant commented Jan 19, 2018

CLA assistant check
All committers have signed the CLA.

Add add_service_for_host endpoint to API
Signed-off-by: Rémy Jacquin <remy@remyj.fr>
@laf

Thanks for doing this :) Couple of small changes and should be good.

@@ -186,6 +186,7 @@ function () use ($app) {
'/services',
function () use ($app) {
$app->get('/:hostname', 'authToken', 'list_services')->name('get_service_for_host');
$app->post('/:hostname', 'authToken', 'add_service_for_host')->name('add_service_for_host');

This comment has been minimized.

@laf

laf Jan 19, 2018

Member

I'd change add_service_for_host to just add_service.

This comment has been minimized.

@remyj38

remyj38 Jan 19, 2018

Contributor

It's already defined in https://github.com/librenms/librenms/blob/master/includes/services.inc.php#L37 and it's used by the function

This comment has been minimized.

@laf

laf Jan 21, 2018

Member

Good shout :)

function add_service_for_host()
{
check_is_admin();

This comment has been minimized.

@laf

laf Jan 19, 2018

Member

We should also allow normal users to add these if they are allowed to access the device.

You can use check_device_permission($device_id); once you have the device id below.

This comment has been minimized.

@remyj38

remyj38 Jan 19, 2018

Contributor

Changed in 7344482

Change permissions to allow users to modify device
Signed-off-by: Rémy Jacquin <remy@remyj.fr>
@scrutinizer-notifier

This comment has been minimized.

scrutinizer-notifier commented Jan 19, 2018

The inspection completed: 2 updated code elements

@laf laf merged commit e12e672 into librenms:master Jan 21, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@laf laf added the API label Jan 21, 2018

@laf

This comment has been minimized.

Member

laf commented Jan 21, 2018

Thanks very much for contributing this @remyj38

image

@lock

This comment has been minimized.

lock bot commented May 16, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 16, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.