Commit Graph

152 Commits

Author SHA1 Message Date
Tony Murray f78edf4d11
New Map Menu (#15969)
* Map Menu
New top level Map menu.
Ability to group custom maps.
Ajax Select controller improvements

* Fix style
2024-04-25 15:32:33 -05:00
Joe Clarke 018597e7bb
Add support for a maintenance boolean in API results. (#15904)
* Add support for a maintenance boolean in API results.

If a device is under maintenance, it would be nice to see that from the
API. This can help drive other automation workflows where LibreNMS forms
a cornerstone in the management source of truth.

* Revert changes made by VSCode formatting.

* Revert two more formatting changes.

* Create a new API endpoint for GETing maintenance status.

This uses the same endpoint name as for setting a device to maintenance
but with a GET verb.

---------

Co-authored-by: Joe Clarke <jclarke@cisco.com>
2024-04-19 19:52:22 -05:00
richard-ririe 08ae2fdbc0
Add API endpoints to update and delete Device Groups (#15774)
* API: Update device groups

* API: Delete device groups
2024-02-05 13:02:36 -06:00
richard-ririe 4277c3387a
API: Add/Remove devices from static devicegroups (#15775) 2024-01-31 13:09:14 -06:00
eskyuu 30953c386f
Add functionality for custom maps (weathermaps) (#15633)
* Initial commit with editor.

* Added custom map models and database migrations.
Modified the controller and view to support saving the custom map settings to the database

* Added menu items and sorted out access permissions for maps and nodes

* Cleaned up some of the conditions in the javascript section of the blade

* Started work on the map data save

* Save of map nodes and edges is complete

* Got the map to load data on page load and added the delete functionality

* Fixed a typo and made link colour black if intertface is down

* Various usability fix-ups

* Show the save button on node and edge delete

* Fixed up access for users without global read

* Increase typeahead search size and standardised the way modals are triggered.

* Update data fetch to copy values into array so I can add more fields

* Convert blank array check to use count()

* Formatting changes

* More formatting fixes

* Formatting again

* DB schema update

* Revert previous commit

* Pass device id to pages

* Remove bad characters from javascript

* Re-add the - character in search results

* Update to avoid background colour being set to the current colour for offline devices

* Fixed a bug in speed detection when no suffix is given

* Fixed up the speed colour calculation and added comments

* Update default edge font size to 12

* Reduce arrow size

* Formatting fix

* Update the custom map controller to handle null interface speeds

* Alter JSON columns to be longtext instead

* Only refresh map data on successful save

* Update labels on default settings to make it clear that they are not saved

* Added timestamps to all custom map tables
Use HasFactory instead of static definitions for custom map tables
convert JSON DB fields to longtext and updated PHP to do the appropriate JSON decoding as a result

* Added missing vis.js images for the editor

* Split the custom map blade into different pages

* formatting fixes

* Initial commit with editor.

* Added custom map models and database migrations.
Modified the controller and view to support saving the custom map settings to the database

* Added menu items and sorted out access permissions for maps and nodes

* Cleaned up some of the conditions in the javascript section of the blade

* Started work on the map data save

* Save of map nodes and edges is complete

* Got the map to load data on page load and added the delete functionality

* Various usability fix-ups

* Show the save button on node and edge delete

* Fixed up access for users without global read

* Increase typeahead search size and standardised the way modals are triggered.

* Convert blank array check to use count()

* Formatting changes

* More formatting fixes

* Formatting again

* DB schema update

* Revert previous commit

* Pass device id to pages

* Remove bad characters from javascript

* Re-add the - character in search results

* Update to avoid background colour being set to the current colour for offline devices

* Reduce arrow size

* Only refresh map data on successful save

* Update labels on default settings to make it clear that they are not saved

* Added timestamps to all custom map tables
Use HasFactory instead of static definitions for custom map tables
convert JSON DB fields to longtext and updated PHP to do the appropriate JSON decoding as a result

* Added missing vis.js images for the editor

* Split the custom map blade into different pages

* Updated the custom maps to use the select2 searches for ports and devices

* Fix port search clearing with select2

* Update DB schema to add timestamps

* Add the ability to set a node alignment value where nodes will align to a grid

* Add a checkbox to re-center edge lines

* Schema update for node alignment

* Removed unused route

* Fixups after rebase

* Remove DevicePortSearchController

* Rebase fixups

* Remove unneeded controller

* Formatting fixes

* Update all network map documentation

* Fixed typo in doc

* Change background imgae database migration

* Update migration for custom map background to fix schema error

* Place a try/catch around the BLOB->MEDIUMBLOB migration

* Formatting fix

* Moved custom map background image location and added some SVG images to test as image options

* Updated the editor to use a static set of device images

* Update the image logic in the editor and added to the viewer

* DB Schema update

* Formatting

* remove svg height/width attributes

* Added some more icon options for arrows

* Added database migration to allow nodes to link to another custom map
Fixed an error in the image migration

* Added the ability to link a node to another custom map

* Formatting fixes

* DB Schema update

* Remove images-custom directory

* Explicitly cast map ID to int

* Made the image selection list dynamic based on the contents of the custom map icons directory

* Formatting fix

* Double-clicking on a link will take you to the link

* Remove whitespace

* Add translations
fix an xss and hopefully not add any new ones
refactor node image to use translations with fallback

* split modals out into separate files
return width/height to avoid js scope issues

* Formatting fixes

* refactor edit select page into a "manage" page
Still left:
validation/custom request
Controller refactor
ui tweaks

* MapSettingsRequest

* Refactor more routes, policy, controller
I think this is the last refactor. Everything is now organized in a standard way.
Missing a method to check if a user has access to a map

* Fix booleans and style

* Add versioning to the background image to prevent browser caching

* Fixed the background image update by splitting it into a separate modal
Changed the delete button on the map editor screen to return to the map list

* Formatting fix

* Added double-click actions in editor to edit nodes and edges

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2024-01-31 08:56:59 -06:00
Nick Lockhart f3e0f3eb93
Add port description API endpoints and documentation (#15578)
* Add port description API endpoints and documentation

* Change "update_port_description" behaviour to mimic webUI behaviour

* Fix code style issue

* Fix another code style issue
2024-01-22 23:07:13 +00:00
VTS 47c6842b01
API: get poller group (#15493)
* API: get poller group

* missed string in doc

* return all poller groups if name/id aren't specified

* add missing doc link

* style fixes

* more style

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-11-01 22:33:35 -05:00
Tony Murray 9fca01830c
Update Tnmsne table backend (#15384)
remove ridiculous sql injection vulnerability
2023-10-05 10:32:21 +02:00
Tony Murray e0444bffcf
Deprecate poller.php (#15370)
* Deprecate poller.php

* Apply fixes from StyleCI

* Remove references to poller.php
Leave wrapper...

* fix python style

* update wraper to call lnms device:poll

* Quiet output too

* make pb happy

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-10-04 16:32:02 -05:00
PipoCanaja 8eeb83928f
Add global NAC page and refactor the per-device one (#15228)
* Adding a NAC global port page

* style

* filter_menu_entry

* typo

* ->when()

* device_id always returned

* use request

* laravel conversion, let see how it goes

* styleci

* ->with('device') to avoid 1 query per item processed

* and rewrote on @murrant advice

* any -> get

Suggested by @murrant

Co-authored-by: Tony Murray <murraytony@gmail.com>

* @push('scripts')

* style

* @endpush

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-08-31 20:25:24 -05:00
Tony Murray 2cd207028a
Implement RBAC (only built in roles) (#15212)
* Install bouncer

* Seeder and level migration

* Display and edit roles

* remove unused deluser page

* Update Radius and SSO to assign roles

* update AlertUtil direct level check to use roles instead

* rewrite ircbot auth handling

* Remove legacy auth getUserlist and getUserlevel methods, add getRoles
Set roles in LegacyUserProvider

* Small cleanups

* centralize role sync code
show roles on user preferences page

* VueSelect component WIP and a little docs

* WIP

* SelectControllers id and text fields.

* LibrenmsSelect component extracted from SettingSelectDynamic

* Handle multiple selections

* allow type coercion

* full width settings

* final style adjustments

* Final compiled assets update

* Style fixes

* Fix SSO tests

* Lint cleanups

* small style fix

* don't use json yet

* Update baseline for usptream package issues

* Change schema, not 100% sure it is correct
not sure why xor doesn't work
2023-08-28 00:13:40 -05:00
VTS 7381c2046c
API get_location (#14779)
* api endpoint to get specific location

* missing nl

* fix missed styleci error

* make requested change
2023-08-03 19:35:20 -05:00
richard-ririe 4c8e5fc783
Add API endpoint to get service graphs (#15138)
* Add API endpoint to get service graphs

* Docs: Add missing title to get_graph_by_service
2023-07-19 22:19:43 -05:00
tarik 3ad19607d0
adding human readable version of /api/v0/fdb/{mac}/detail (#15045)
* adding human readable version of /api/v0/fdb/{mac}/detail

* adding last seen field in human readable format

* fixing styling issue

* fixing another styling issue

* removing stale variable

* adding a limit to number of results returned in order to limit memory issues

* adding the documentation for fdb_detail api

* Wording fix

* wording fix again. smh

---------

Co-authored-by: Justin Lentz <monkeybrains7@gmail.com>
2023-07-07 23:24:50 -05:00
Jellyfrog b14e2d4609
Apply fixes from StyleCI (#15101)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-06-13 13:35:00 +02:00
Jellyfrog 2b3575a5e9
Laravel 10.x Shift (#14995)
* Apply code style

* Remove explicit call to register policies

* Shift core files

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.

* Bump Laravel dependencies

* Add type hints for Laravel 10

* Shift cleanup

* wip

* wip

* sync translation

* Sync back config

* Public Path Binding

* QueryException

* monolog

* db::raw

* monolog

* db::raw

* fix larastan collections

* fix phpstan bug looping forever

* larastan errors

* larastan: fix column type

* styleci

* initialize array

* fixes

* fixes

---------

Co-authored-by: Shift <shift@laravelshift.com>
2023-05-24 22:21:54 +02:00
eskyuu ce0734ff5d
Added support for user timezones and user browser timezone by default (incomplete) (#13626)
* Added support for user timezones and user browser timezone byt default

* Formatting fixes

* Use the timezone for alert log display

also added validation for the timezone because it's being used in SQL.

* Formatting fixes

* Added return type

* Formatting"

* Update the latency graphs to use the user timezone

* Simplify the web routes config

* Update phpstan to ignore type error

* Fixed up the phpstan config

* Reverse phpstan change

* Re-apply phpstan override

* Remove the option to unset the session timezone

* Formatting fix

* Update outge and event logs to use session timezone

* Fix route for the timezone control

* Made the timezone more dynamic

* Fix a logic error that was stopping the timezone from being set automatically on login

* Prevent getPref from being called twice

* again prevent getPref double call

* getPref double call

* Fixed typo made during merge

* Fixed merge error in phpstan-baseline.neon

* Change spaces to tabs in phpstan-baseline.neon

* Update error count

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-05-09 10:24:48 -05:00
Tony Murray 5c25cece48
Convert the inventory page to Laravel (#15004)
* Convert the inventory page to Laravel
Fix several XSS issues (hopefully no new ones snuck in)
Small improvement to the SelectController to allow filtering by filterFields()

* style fixes

* Fix lint issues

* Fix part device filter
2023-04-28 07:51:41 -05:00
Tony Murray 8891a1bc6d
Fix SSO login (#14997)
* Fix SSO login

* like this?
2023-04-24 11:05:15 -05:00
Jellyfrog cee100bf44
Fix routes after Laravel9 (#14977) 2023-04-17 22:41:09 +02:00
Jellyfrog 0a351b49fd
Laravel 9.x Shift (#14504)
* Move `resources/lang` folder

* Shift registered middleware

* Remove `fruitcake/laravel-cors` dependency

* Streamline `$commands` property

* Upgrade to Flysystem 3.0

* Shift core files

* Convert `optional()` to nullsafe operator

* Remove unnecessary `$model` property

* Convert route options to fluent methods

Laravel 8 adopts the tuple syntax for controller actions. Since the old options array is incompatible with this syntax, Shift converted them to use modern, fluent methods.

* Convert deprecated `$dates` property to `$casts`

* Shift config files

* Default config files

In an effort to make upgrading the constantly changing config files
easier, Shift defaulted them and merged your true customizations -
where ENV variables may not be used.

* Bump Laravel dependencies

* Use `<env>` tags for configuration

`<env>` tags have a lower precedence than system environment variables making it easier to overwrite PHPUnit configuration values in additional environments, such a CI.

Review this blog post for more details on configuration precedence when testing Laravel: https://jasonmccreary.me/articles/laravel-testing-configuration-precedence/

* Fix error provider

* Match new symfony syntax

* Match upstream syntax

* Fix route syntax

* generate composer.lock

* Sync back configs

* routes

* composer

* Fix more flare

* fix cors

* sync lang

* Apply fixes from StyleCI (#14517)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* bump larastan

* update packages

* wip

* Temporarily lower phpstan level

* Update phpstan.neon

* wip

* wip

* wip

* Apply fixes from StyleCI (#14592)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* test

* Update CiHelper.php

* Update test.yml

* Update CiHelper.php

* Update CiHelper.php

* Apply fixes from StyleCI (#14616)

Co-authored-by: StyleCI Bot <bot@styleci.io>

* test?

* fix phpstan problems

* dont run snmpsim on github ci

* Fix whitespace

* More whitespace

* More whitespace ???

* I think the space broke it

* fix the reset of the whitespace

* hard code auth guard

---------

Co-authored-by: Shift <shift@laravelshift.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-04-17 06:51:35 -05:00
SourceDoctor 93f270155f
snmp-scan filter for dns resolved devices (#14934)
* snmp-scan filter for dns resolved devices

* .

* add console arguments
2023-04-07 13:24:18 -05:00
Stef 82bd437e47
Syslog sink over http for logstash (or any json source) (#14424)
* inital commit of a new syslog sink over http

* cosmetics

* cosmetics fix...

* cosmetic fix again

* cosmetics fix again

* its nice now...

* add non blocking option

* Syslog Sink integrated as API PUT method

* lint fix

* Update includes/html/api_functions.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>

* Update includes/html/api_functions.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>

* Update includes/html/api_functions.inc.php

Co-authored-by: Tony Murray <murraytony@gmail.com>

* change to POST, fix decoding issue and json exception

* logstash/json documentation added. syslog documentation a bit re-structured

* lint fix

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
2023-03-15 08:14:38 -05:00
Jellyfrog 68e0b3df28
Apply fixes from StyleCI (#14899)
Co-authored-by: StyleCI Bot <bot@styleci.io>
2023-03-13 22:32:22 +01:00
Tony Murray 8ea3f5cd06
Offer opt in to usage and error reporting during install (#13906)
and on the about page
2022-12-15 19:52:22 -06:00
Tony Murray abe4f6fbc0
API: fix port search with slashes (#14403) 2022-10-02 00:01:15 -05:00
Tony Murray 5c76890373
Add @signedGraphTag() and @signedGraphUrl() blade directives (#14269)
* More secure external graph access
Add @signedGraphTag() and @signedGraphUrl() blade directives
Takes either an array of graph variables or a url to a graph
Uses a signed url that is accessible without user login, embeds signature in url to authenticate access
See Laravel Signed Url for more details.
Adds Laravel route to graphs (does not change links to use it yet)
@graphImage requires the other PR
Also APP_URL is required in .env

* missing files from rebase

* Fix url parsing with a get string

* allow width and height to be omitted

* Documentation

* Add to, otherwise it will always be now

* Doc note for to and from relative security

* fix vars.inc.php (Laravel has a dummy url here)
2022-09-03 12:48:43 -05:00
Jellyfrog dd688dc73b
Use empty string instead of null for routes (#14247) 2022-08-25 18:25:19 +02:00
Tony Murray 7a0d604cdd
Automatic fixes for validation failures (#13930)
* Automatic fixes for validations

* webui

* lint fixes

* Fix an install issue with ConfigSeeder requesting cli input in web page.

* Do not use c_echo in validate.php print_fail()
2022-06-10 16:25:33 -05:00
Tony Murray 0f2734a1b2
lnms scan respect -q parameter (#14027)
* lnms scan respect -q parameter

* better operation when tty isn't supported

* fix logic
2022-06-10 10:18:16 -05:00
Tony Murray 32f1ce494e
Dashboard code cleanup (#13996)
* Dashboard Cleanup
Remove static widgets table, list of available widgets should not be in the database.
Remove legacy ajax scripts
Cleanup and reorganize controllers

* reorganize code to put all dashboard things into it's controller
better url scheme while supporting the original

* lint clean ups

* properly formatted language file

* style fixes

* update schema
2022-05-31 08:08:40 -05:00
Chris A. Evans 5a085f79e5
Feature: Add support to REST API for creating Maintenance Schedules for Device Groups (#13985)
* Add support to REST API for creating Maintenance Schedules for Device Groups

* Update documentation to include the maintenance_devicegroup API endpoint

* Fix quotes

* Fix whitespace

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-05-27 10:38:47 -05:00
SourceDoctor 1c6fc0f130
Device Types Widget (#13670)
* show all Device Types in Location Overview

* .

* .

* .

* get device types from config_definition

* reduce column to present device types

* .

* fixes

* .

* show/hide columns, even device types which are not present

* only show top n used device groups

* .

* .

* .

* Device Type Widget

* .

* .

* linter fix

* Update DeviceTypeController.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-05-25 15:03:01 -05:00
Tony Murray 0a84098211
Port Validation Page to Laravel (#13921)
* Revamp validate web page
 to load page then validate, instead of validate then load page

* style fixes

* lint cleanups

* fixes

* translations and a couple fixes

* style fixes

* move result serialization into the class.
2022-04-14 11:22:40 -05:00
Tony Murray 1bfd411995
New device:add code (#13842)
* New device:add code
pre-requisite for updating other code paths
includes option to set display name
separate validation code from device creation

* remove duplicate community and v3 creds

* style fixes

* some lint fixes

* fix phpstan

* Exception cleanup
improved messages and translations

* port association mode to enum
well, pseudo enum

* defaults and cleanups

* fixed/improved validation messages

* fix tests

* fix stupid ide refactor mistake

* lint fixes
2022-03-12 16:14:32 -06:00
Josh Silvas a9e111f3eb
Adds API call to update port notes on devices. (#13834)
* Adds API call to update port notes on devices.

* Lint fixes.

* Fixes file permissions to proper values.
2022-03-10 22:29:08 +01:00
Jellyfrog 09929bd686
Implement OAuth and SAML2 support (#13764)
* Implement OAuth and SAML2 support via Socialite

* Add socialite docs

* fixes

* Additional information added

* wip

* 22.3.0 targeted version

* Allow mysql auth as long as there is a password saved

Co-authored-by: laf <gh+n@laf.io>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2022-02-20 22:05:51 +01:00
Neil Lathwood 95970af78e
Moved some pages to be within admin route (#13782)
* Moved plugin admin pages to be within admin route
* Wrap html transports page in admin check
* Moved Port group controller to be admin protected
* fixed tests
2022-02-14 08:40:30 +01:00
Tony Murray 29bd6789cb
Stp module rewrite (#13570)
* STP module rewrite WIP

* Finish rewrite

* Ignore disabled and log root/topology changes

* Remove interfaces for now

* fix style

* Lint fixes

* Document ResolvesPortIds and hide map functions

* whitespace fixes

* Revert to stpInstances in case someone writes mstp support

* missed one

* phpstan fixes

* Handle table and oids separately

* forgot to register observer

* Test data and correct non-table handling in SnmpResponse->table()

* update test

* test data

* revert aos7 silly things

* minimal polling

* Update test data

* order ports_ntp and rename new field to port_index

* forgot the db_schema

* revert ciena-sds port things

* MSTP support, maybe

* Adding test data

* Filter bad lines instead of discarding the entire snmp response
and capture fixes and test data

* fresh data

* add os data

* update data, ignore unfound ports, obviously bad device implementation.

* fixes

* Ignore context files in os detection test

* Remove empty table data

* add ciena-sds vlan

* designatedCost column is too small

* Update stp webui

* Refactor code to interfaces, to allow vendor mibs

* update schema

* fix issues added by abstraction

* STP fixes

* Default to no context for vlan 1

* never store vlan 1

* Update test data

* remove eltex brokenness

* fix style

* fix stan

* Fix Rewrite MAC to Hex padding with floats

* fix sqlite migration
2022-01-30 16:28:18 -06:00
Andrea Beccaris 0fc2f9e4c9
Add API-routes for listing MPLS SAPs and services (#13561)
* add apis for mpsl services and saps

* updated docs

* removed dbFetch, orm instead

* changed queries

* Removed unused variables

* Update api_functions.inc.php

* Update api_functions.inc.php

* Update api_functions.inc.php

* Update api_functions.inc.php

Co-authored-by: laf <gh+n@laf.io>
2022-01-20 08:15:23 -06:00
Tony Murray a95efd6d2a
Global search: search device display (#13583)
* Global search: search device display
Add display field to search (also port_desc_descr, portName, and bgpPeerDescr)
Rewrite backend
update typeahead bundle
update devices and ports indexes
reduce some port field sizes so we can index them

* Style fixes

* remove nonsense
2021-12-06 16:12:24 +01:00
Tony Murray c79b187d72
Poller rewrite (Try 2) (#13525)
* core WIP

* try to finish up

* trim space too
and a couple of cleanups

* update test data

* put escapes back

* another net-snmp difference

* correct copy paste error

* WIP

* Use new code YAY

* a tiny bit more

* Kind of working

* Handle manual modules correctly

* convert core to modern module

* Only save metrics if modules is not overridden

* correct module exists check

* database error handling

* debug handling

* restore bad changes

* Introduce Actions
 RunAlertRulesAction
 UpdateDeviceGroupsAction

* tweaks to output

* Fix some issues in outside code

* Style fixes

* fixes to module status checks

* typehints!

* Use logger only and DI

* OS module not named correctly

* Work on quiet output a bit more

* generically don't change output when disabling debug if the driver is already stack

* Fix missing $device variable for legacy os polling
Fix missing dbFacile functions when no legacy modules polled in RunAlertRulesAction

* restore legacy os module shim

* use the new poller code for tests

* PollingDevice event

* Fix some issues and enable/disable error reporting around legacy modules

* typehints

* fully update baseline

* Use Process for version commands so we don't leak debug output.

* don't detect rrdtool version in ci every time

* style fixes

* Warning fixes

* more fixes

* re-update baseline

* remove diff noise

* fix up alerts

* Catch exceptions in device ip lookup

* Revert accidental snmp.inc.php poller target change
(should have been ?: not ??)
2021-11-17 19:23:55 -06:00
Tony Murray f8764ddcb5
Revert "Poller command rewrite (#13414)" (#13524)
This reverts commit 1752d1efd4.
2021-11-16 21:40:29 -06:00
Tony Murray 1752d1efd4
Poller command rewrite (#13414)
* core WIP

* try to finish up

* trim space too
and a couple of cleanups

* update test data

* put escapes back

* another net-snmp difference

* correct copy paste error

* WIP

* Use new code YAY

* a tiny bit more

* Kind of working

* Handle manual modules correctly

* convert core to modern module

* Only save metrics if modules is not overridden

* correct module exists check

* database error handling

* debug handling

* restore bad changes

* Introduce Actions
 RunAlertRulesAction
 UpdateDeviceGroupsAction

* tweaks to output

* Fix some issues in outside code

* Style fixes

* fixes to module status checks

* typehints!

* Use logger only and DI

* OS module not named correctly

* Work on quiet output a bit more

* generically don't change output when disabling debug if the driver is already stack

* Fix missing $device variable for legacy os polling
Fix missing dbFacile functions when no legacy modules polled in RunAlertRulesAction

* restore legacy os module shim

* use the new poller code for tests

* PollingDevice event

* Fix some issues and enable/disable error reporting around legacy modules

* typehints

* fully update baseline

* Use Process for version commands so we don't leak debug output.

* don't detect rrdtool version in ci every time

* style fixes

* Warning fixes

* more fixes

* re-update baseline

* remove diff noise

* fix up alerts
2021-11-16 16:59:46 -06:00
PipoCanaja 193535871f
Allow LegacyPlugin Pages to receive all parameters (#13519) 2021-11-15 09:30:50 +01:00
Tony Murray 4c572427b2
Allow legacy plugins to use any method (#13392) 2021-10-20 08:00:09 -05:00
Kevin Zink 98ed6bb9dc
New plugin system based on Laravel Package Development (#12998)
* use Blade view and Eloquent models for plugins

* move views

* fix style

* fix style

* revert mistake

* Update Plugin.php

delete test property "name"

* rename plugin function to settings

* last but not least - rename in Test.php

* Rename Test to Example

* fix typo

* fix style

* fix style

* fix style

* fix style - I hate tabs...

* Extract view calls

* fix method calls and style

* Move Models the the abstract class

* fix style

* Convert to traits

* Change the Example description

* Fix style

* Fix style

* Fix style

* Convert plugin function to Model static methods and delete .inc.php

* fix style

* fix style

* Use scope

* final methods blows up legacy code

* Config > \LibreNMS\Config

* convert the static string to a static method

* Correct placement in the page

* fix tabs

* fix style

* Rename from tait to hook

to make it easier to understand and be complient

* rename file

* Typo

* Started to change the docu

* change to a more usefully Device_Overview example

* and activate of course

* PluginManager

* fix .gitignore

* only php files in the root folder

* corrected .gitignore with all files :)

* Rename the Hooks and ExampleClass for better readability

* Fix style

* Fix style

* Exception handling (especially if DB is not present)

* Fix style and update schema

* fix indentation

* actually correct indent

* fix migration collation check include utf8mb4_bin

* stop phpstan whining

* A view lines documentation

* add typeHints

* Allow return null on handle

* lint

* fix return types

* fix logic of column collation check

* Fix MenuEntryHook

* switch to longtext instead of json type for now :D

* try phpstan on PHP 7.3

* set phpstan target version to 7.3

* all the typehints

* optional

* more

* Use namespace to prevent view collisions
disambiguate plugin and hook
no magic guessing of names in PluginManager, bad assumptions
remove unused plugins from the DB

* cleanup plugin menu

* cleanup on shutdown and ignore but log query error on cleanup

* instanceof must be called against an instance

* Allow multiple hooks per plugin

* Port plugin ui code to Laravel

* page instead of settings for v1 plugins

* actually working settings pages
a little url cleanup plugin/admin -> plugin/settings

* fix style

* Add page hook

* PHPstan

* Try to fix Illuminate\Http\RedirectResponse

* typehint

* Rewrite the doc

* Fix style

Co-authored-by: PipoCanaja <38363551+PipoCanaja@users.noreply.github.com>
Co-authored-by: Tony Murray <murraytony@gmail.com>
2021-10-19 06:53:28 -05:00
Nathan Manzi fb7d89c4c3
Add get_ports_by_group API function (#13361)
* implement api route get_ports_by_group

* Update API docs for new get_ports_by_group

* Fix misspelling of function names and routes
2021-10-18 20:47:37 -05:00
Tony Murray 0b8b97bb68
Push Notifications (Mobile and PC) (#13277)
* Update manifest and add service worker
cleanup icons a bit

* Push notifications WIP

* navigate working

* cleanup

* acknowledge wired up

* Set VAPID keys on composer install

* Component to control notification permissions.

* Allow all user option to validate

* Enable on browser load if transport exists.

* Check for transport before showing user permissions
translations

* Documentation

* style fixes

* access via the attribute model

* fix alerting test

* update schema

* cleanup subscription on disable

* non-configurable db and table for webpush subscriptions (respect system connection)

* revert AlertTransport change
hopefully phpstan can figure it out

* phpstan fixes

* Support custom details display

* Match transport names to brand's preferred display

* less duplicate id errors

* Tests are done in Laravel code now so
remove legacy function usage... could be better, but ok

* Style fixes

* Style fixes 2

* Fix alert test

* Doc updates requires HTTPS and GMP

* unregister subscription when permission is set to denied

* cleanup after user deletion

* delete the right thing

* fix whitespace

* update install docs to include php-gmp

* suggest ext-gmp

* update javascript

* Update functions.php

Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2021-10-06 07:29:47 -05:00
Jellyfrog 9ef94323f5
Update dependencies (#13310)
* Bump composer dependencies

  - Upgrading brick/math (0.9.2 => 0.9.3)
  - Upgrading composer/ca-bundle (1.2.10 => 1.2.11)
  - Upgrading composer/composer (2.1.3 => 2.1.8)
  - Upgrading composer/xdebug-handler (2.0.1 => 2.0.2)
  - Upgrading dapphp/radius (2.5.5 => 2.5.6)
  - Upgrading doctrine/annotations (1.13.1 => 1.13.2)
  - Upgrading doctrine/cache (2.0.3 => 2.1.1)
  - Upgrading doctrine/dbal (2.13.2 => 2.13.3)
  - Upgrading facade/flare-client-php (1.8.1 => 1.9.1)
  - Upgrading facade/ignition (2.11.0 => 2.14.0)
  - Upgrading fakerphp/faker (v1.15.0 => v1.16.0)
  - Upgrading filp/whoops (2.13.0 => 2.14.3)
  - Upgrading friendsofphp/php-cs-fixer (v2.19.0 => v2.19.2)
  - Upgrading graham-campbell/result-type (v1.0.1 => v1.0.2)
  - Upgrading laravel/dusk (v6.15.1 => v6.18.1)
  - Upgrading laravel/framework (v8.49.2 => v8.62.0)
  - Locking laravel/serializable-closure (v1.0.2)
  - Upgrading laravel/tinker (v2.6.1 => v2.6.2)
  - Upgrading league/commonmark (1.6.5 => 1.6.6)
  - Upgrading league/flysystem (1.1.4 => 1.1.5)
  - Upgrading league/mime-type-detection (1.7.0 => 1.8.0)
  - Upgrading maximebf/debugbar (v1.16.5 => v1.17.1)
  - Upgrading mockery/mockery (1.4.3 => 1.4.4)
  - Upgrading monolog/monolog (2.3.0 => 2.3.4)
  - Upgrading nesbot/carbon (2.50.0 => 2.53.1)
  - Upgrading nikic/php-parser (v4.11.0 => v4.13.0)
  - Upgrading nunomaduro/collision (v5.5.0 => v5.10.0)
  - Upgrading phar-io/manifest (2.0.1 => 2.0.3)
  - Upgrading php-parallel-lint/php-parallel-lint (v1.3.0 => v1.3.1)
  - Upgrading phpdocumentor/type-resolver (1.4.0 => 1.5.0)
  - Upgrading phpmailer/phpmailer (v6.5.0 => v6.5.1)
  - Upgrading phpoption/phpoption (1.7.5 => 1.8.0)
  - Upgrading phpseclib/phpseclib (3.0.9 => 3.0.10)
  - Upgrading phpspec/prophecy (1.13.0 => 1.14.0)
  - Upgrading phpstan/phpstan (0.12.92 => 0.12.99)
  - Upgrading phpunit/php-code-coverage (9.2.6 => 9.2.7)
  - Upgrading phpunit/phpunit (9.5.6 => 9.5.10)
  - Upgrading predis/predis (v1.1.7 => v1.1.8)
  - Upgrading ramsey/collection (1.1.3 => 1.2.1)
  - Upgrading ramsey/uuid (4.1.1 => 4.2.3)
  - Upgrading seld/phar-utils (1.1.1 => 1.1.2)
  - Upgrading symfony/console (v5.3.2 => v5.3.7)
  - Upgrading symfony/css-selector (v5.3.0 => v5.3.4)
  - Upgrading symfony/debug (v4.4.25 => v4.4.31)
  - Upgrading symfony/error-handler (v5.3.3 => v5.3.7)
  - Upgrading symfony/event-dispatcher (v5.3.0 => v5.3.7)
  - Upgrading symfony/filesystem (v5.3.3 => v5.3.4)
  - Upgrading symfony/finder (v5.3.0 => v5.3.7)
  - Upgrading symfony/http-foundation (v5.3.3 => v5.3.7)
  - Upgrading symfony/http-kernel (v5.3.3 => v5.3.9)
  - Upgrading symfony/mime (v5.3.2 => v5.3.8)
  - Upgrading symfony/options-resolver (v5.3.0 => v5.3.7)
  - Upgrading symfony/polyfill-intl-grapheme (v1.23.0 => v1.23.1)
  - Upgrading symfony/polyfill-mbstring (v1.23.0 => v1.23.1)
  - Upgrading symfony/polyfill-php80 (v1.23.0 => v1.23.1)
  - Locking symfony/polyfill-php81 (v1.23.0)
  - Upgrading symfony/process (v5.3.2 => v5.3.7)
  - Upgrading symfony/routing (v5.3.0 => v5.3.7)
  - Upgrading symfony/stopwatch (v5.3.0 => v5.3.4)
  - Upgrading symfony/string (v5.3.3 => v5.3.7)
  - Upgrading symfony/translation (v5.3.3 => v5.3.9)
  - Upgrading symfony/var-dumper (v5.3.3 => v5.3.8)
  - Upgrading symfony/yaml (v4.4.26 => v4.4.29)
  - Upgrading tecnickcom/tcpdf (6.4.1 => 6.4.2)
  - Upgrading theseer/tokenizer (1.2.0 => 1.2.1)

* Update npm dependecies

* Update phpstan ignores after laravel upgrades

* Merge laravel/laravel repo changes
2021-10-02 18:04:59 -05:00