grafana/pkg/services/alerting
Marcus Efraimsson 53cd39fde5 Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900)
* dashboards: new command for validating dashboard before update

Removes validation logic from saveDashboard and later on use the new command for validating
dashboard before saving a dashboard. This due to the fact that we need to validate permissions
for overwriting other dashboards by uid and title.

* dashboards: use the new command for validating dashboard before saving

Had to refactor dashboard provisioning a bit to be able to sidetrack the permission validation
in a somewhat reasonable way.
Adds some initial tests of the dashboard repository, but needs to be extended later. At least
now you can mock the dashboard guardian

* dashboards: removes validation logic in the save dashboard api layer

Use the dashboard repository solely for create/update dashboards and let it do all
the validation. One exception regarding quota validation which still is in api layer
since that logic is in a macaron middleware.
Need to move out-commented api tests later.

* dashboards: fix database tests for validate and saving dashboards

* dashboards: rename dashboard repository to dashboard service

Split the old dashboard repository interface in two new interfaces, IDashboardService and
IDashboardProvisioningService. Makes it more explicit when using it from the provisioning package
and there's no possibility of calling an incorrect method for saving a dashboard.

* database: make the InitTestDB function available to use from other packages

* dashboards: rename ValidateDashboardForUpdateCommand and some refactoring

* dashboards: integration tests of dashboard service

* dashboard: fix sqlstore test due to folder exist validation

* dashboards: move dashboard service integration tests to sqlstore package

Had to move it to the sqlstore package due to concurrency problems when running
against mysql and postgres. Using InitTestDB from two packages added conflicts
when clearing and running migrations on the test database

* dashboards: refactor how to find id to be used for save permission check

* dashboards: remove duplicated dashboard tests

* dashboards: cleanup dashboard service integration tests

* dashboards: handle save dashboard errors and return correct http status

* fix: remove log statement

* dashboards: import dashboard should use dashboard service

Had to move alerting commands to models package due to problems with import cycles of packages.

* dashboards: cleanup dashboard api tests and add some tests for post dashboard

* dashboards: rename dashboard service interfaces

* dashboards: rename dashboard guardian interface
2018-02-19 11:12:56 +01:00
..
conditions alerting: add count_non_null reducer 2017-10-13 09:47:10 +02:00
notifiers Update OpsGenie Notifier to support different api domains. 2018-01-22 22:27:35 +03:00
test-data alerting: make alert extractor backwards compatible 2017-12-19 11:20:05 +01:00
commands.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
engine.go use same key as mt 2017-09-18 14:59:59 +02:00
eval_context_test.go Add a per-notifier ShouldNotify() 2017-12-12 17:35:54 +01:00
eval_context.go changes to new urlformat for home dashboard (#10738) 2018-02-05 10:24:48 +01:00
eval_handler_test.go fixes broken alert eval when first condition is using OR 2017-12-13 13:37:10 +01:00
eval_handler.go fixes broken alert eval when first condition is using OR 2017-12-13 13:37:10 +01:00
extractor_test.go test: remove unused code 2017-12-19 11:23:21 +01:00
extractor.go alerting: make alert extractor backwards compatible 2017-12-19 11:20:05 +01:00
interfaces.go Add a per-notifier ShouldNotify() 2017-12-12 17:35:54 +01:00
models.go fix(alerting): fixed evaluation for no_value condition, fixes #7244 (#7247) 2017-01-13 12:32:30 +01:00
notifier.go alert: use new url format 2018-02-01 14:08:51 +01:00
reader.go convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
result_handler.go Add a per-notifier ShouldNotify() 2017-12-12 17:35:54 +01:00
rule_test.go tech(alerting): remove comments 2016-12-19 15:40:09 +01:00
rule.go feat(alerting): improve error logging for extracting alerts 2016-11-15 11:47:46 +01:00
scheduler.go fix(alerting): remove possible divide by zero panic 2016-11-17 15:20:14 +01:00
test_notification.go include error message in email notification (#8392) 2017-05-17 09:51:51 +02:00
test_rule.go tech: replace context.TODO with background ctx 2017-02-24 09:20:28 +01:00
ticker_test.go moved icon (#10681) 2018-01-31 09:52:29 +01:00
ticker.go feat(alerting): began work on splitting scheduler into scheduler and engine 2016-06-06 11:56:58 +02:00