grafana/pkg
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
..
api Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
bus (format) run go fmt in pkg 2016-12-14 12:17:38 +09:00
cmd cli: download latest dependency by default 2018-02-16 09:54:37 +01:00
components Improve logging in the phantomjs renderer (#10697) 2018-02-01 14:04:52 +01:00
events feat(signup): progress on new sign up and email verification flow, #2353 2015-08-28 15:14:24 +02:00
log Improve logging in the phantomjs renderer (#10697) 2018-02-01 14:04:52 +01:00
login WIP: Protect against brute force (frequent) login attempts (#10031) 2018-01-26 10:41:41 +01:00
metrics stats: send amount of stars as stats 2018-01-23 22:51:05 +01:00
middleware mark redirect_to cookie as http only 2018-02-15 10:56:29 +01:00
models Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
plugins Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
services Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
setting WIP: Protect against brute force (frequent) login attempts (#10031) 2018-01-26 10:41:41 +01:00
social Fix #10823 (#10851) 2018-02-12 09:24:01 +01:00
tracing jaeger: capitalize tracer name 2017-09-27 16:38:00 +02:00
tsdb improve error message for invalid/unknown datatypes (#10834) 2018-02-14 15:21:00 +01:00
util Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00