grafana/pkg/api
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
..
avatar fix missing profile icon (#10469) 2018-01-09 13:58:03 +01:00
dtos Merge pull request #10760 from grafana/10749_link_to_folder 2018-02-05 11:34:59 +01:00
live refactor(http): refactoring http server 2016-12-21 14:36:32 +01:00
pluginproxy proxyds: delete cookies except those listed in keepCookies 2017-12-14 11:46:44 +01:00
static feat(macaron): upgrades macaron version 2016-01-13 15:11:23 +01:00
admin_users.go convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
admin.go Fixed api bugs, stats endpoint working 2016-01-24 21:18:17 -08:00
alerting_test.go alerting: add permission check in api for pausing alerts 2018-01-30 14:41:25 +01:00
alerting.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
annotations_test.go api: extract api test code to common_test.go 2018-01-30 13:17:48 +01:00
annotations.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
api.go Dashboard acl query fixes (#10909) 2018-02-14 15:04:26 +01:00
apikey.go More work on email and notification infra #1456 2015-06-05 11:08:19 +02:00
app_routes.go Merge pull request #9378 from mattbostock/verify_tls 2017-10-12 11:11:02 +02:00
common_test.go api: extract api test code to common_test.go 2018-01-30 13:17:48 +01:00
common.go fix(api): fixed issue with api content-type in api success messages, fixes #6160 2016-10-01 16:52:52 +02:00
dashboard_acl_test.go Dashboard acl query fixes (#10909) 2018-02-14 15:04:26 +01:00
dashboard_acl.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
dashboard_snapshot.go convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
dashboard_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
dashboard.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
dataproxy.go dataproxy: added caching of datasources when doing data proxy requests, #9078 2017-08-23 13:31:26 +02:00
datasources_test.go api: extract api test code to common_test.go 2018-01-30 13:17:48 +01:00
datasources.go api: fix so that datasources functions returns Response 2017-11-16 16:29:05 +01:00
frontendsettings.go Merge branch 'master' into develop 2017-09-18 12:32:29 +02:00
grafana_com_proxy.go Always verify TLS unless explicitly told otherwise 2017-10-06 17:09:27 +01:00
http_server.go imguploader: Add support for new internal image store (#6922) 2018-01-12 21:40:12 +01:00
index.go ds: updated ds nav 2018-01-18 18:17:58 +01:00
login_oauth.go fix: error handling now displays page correctly, fixes #10777 2018-02-06 12:28:17 +01:00
login.go WIP: Protect against brute force (frequent) login attempts (#10031) 2018-01-26 10:41:41 +01:00
metrics.go follow go idiom and return error as second param 2017-09-21 18:04:16 +02:00
org_invite.go ux: org user management changes 2017-12-13 13:16:44 +01:00
org_users.go user picker should only include users from current org (#10845) 2018-02-09 10:42:37 +01:00
org.go convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
password.go security: fixed returning info on weither user exists or not in password reset call, fixes #7619 2017-04-11 16:50:16 +02:00
playlist_play.go WIP: move guardian logic for search into the sql query 2017-06-17 02:34:05 +02:00
playlist.go WIP: move guardian logic for search into the sql query 2017-06-17 02:34:05 +02:00
plugins.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
preferences.go feat(preferences): theme and home dashbord settings now work work on profile and org settings page 2016-04-02 13:54:06 -07:00
quota.go fix getting default quota as map[string]int64 2015-09-15 20:31:58 +08:00
render.go renderer: avoid calling Handle twice 2017-12-28 14:37:10 +01:00
route_register_test.go bug: enable HEAD requests again 2017-09-20 09:45:00 +02:00
route_register.go removes invalid comment 2017-11-16 16:55:02 +01:00
search.go dashboard and folder search with permissions 2018-02-08 17:11:01 +01:00
signup.go convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
stars.go Api handler refactoring using the wrap and response func/type, fixed small issue in influxdb 0.9 response handling 2015-05-20 14:59:38 +02:00
team_members.go teams: adds some validation to the API 2018-02-16 11:46:20 +01:00
team_test.go teams: add team count when searching for team 2017-12-15 11:08:06 +01:00
team.go teams: use orgId in all team and team member operations (#10862) 2018-02-09 17:26:15 +01:00
user_test.go admin: adds paging to global user list 2017-02-13 12:59:36 +01:00
user.go minor user avatar stuff 2017-08-18 14:49:04 +02:00