grafana/pkg/util
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
..
encoding_test.go test: adds tests for password encodiing 2017-11-09 17:55:12 +01:00
encoding.go Use hex.EncodeToString to encode to hex 2017-11-08 22:44:31 +05:30
encryption_test.go Config Array Syntax (#8204) 2017-04-25 09:14:29 +02:00
encryption.go securejson: decrypt should not modify src 2017-09-08 10:19:07 +02:00
filepath.go fix(plugins): fixes missed dist loading for plugindir 2016-03-03 11:04:26 +01:00
json.go Fixed hashing of passwords, Closes #3 2015-01-08 09:00:00 +01:00
shortid_generator_test.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
shortid_generator.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
strings_test.go feat: store last seen date for users and present in stats and user lists, closes #9007 2017-08-09 10:36:41 +02:00
strings.go feat: store last seen date for users and present in stats and user lists, closes #9007 2017-08-09 10:36:41 +02:00
url_test.go fix(dataproxy): no trailing slash if proxypath is empty 2016-01-29 18:44:33 +01:00
url.go fix render http[get] params error 2017-11-28 22:20:22 +08:00
validation.go More work on email and notification infra #1456 2015-06-05 11:08:19 +02:00