grafana/pkg/models
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
..
address.go feat(organization): added update org address to http api and to org details settings view, closes #2672 2015-09-08 14:22:44 +02:00
alert_notifications.go tech(notifications): splitt into 3 queries 2016-09-06 08:43:15 +02:00
alert_test.go feat(alerting): add alert message to slack integration 2016-08-12 10:12:04 +02:00
alert.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
apikey.go HTTP API: grafana /render calls nows with api keys, Fixes #1649 2015-04-08 08:59:12 +02:00
dashboard_acl_test.go WIP: Permission Type as string in permission query 2017-06-12 15:49:09 +02:00
dashboard_acl.go Dashboard acl query fixes (#10909) 2018-02-14 15:04:26 +01:00
dashboard_snapshot.go snapshots: improve snapshot listing performance, #9314 (#9477) 2017-10-10 14:25:19 +02:00
dashboard_version.go dashboard history: clean up dashboard version history 2017-11-14 18:22:18 +03:00
dashboards_test.go dashboards as cfg: create dashboard folders if missing 2017-12-28 13:33:11 +01:00
dashboards.go Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900) 2018-02-19 11:12:56 +01:00
datasource_cache_test.go Retain old name for TLS client auth 2017-10-11 08:18:04 +01:00
datasource_cache.go Retain old name for TLS client auth 2017-10-11 08:18:04 +01:00
datasource.go datasource as cfg: support globbing 2017-11-15 14:30:32 +01:00
health.go feat: added api health endpoint that does not require auth and never creates sessions, returns db status as well. #3302 2017-04-25 17:17:45 +02:00
helpflags.go ux(getting started): progress on getting started panel and persited help flag states, #6466 2016-11-09 10:41:39 +01:00
home_dashboard.go Worked on home dashboard 2015-02-03 15:04:35 +01:00
login_attempt.go login: uses epochs for login throtting. 2018-02-16 17:25:46 +01:00
models.go grafana_com: changed name of oauth grafana_net integration (old settings names still work), and updated login button look, closes #8415 2017-05-22 14:56:50 +02:00
notifications.go fix: better error handling / messsage when testing email notification when stmp is not configured, fixes #8093 2017-04-25 13:16:41 +02:00
org_user.go user picker should only include users from current org (#10845) 2018-02-09 10:42:37 +01:00
org.go feat(organization): added update org address to http api and to org details settings view, closes #2672 2015-09-08 14:22:44 +02:00
playlist.go fix(playlist): fixed sorting issue with playlist playback, fixes #5467 2016-09-22 10:06:03 +02:00
plugin_settings.go refactor(securejsondata): extract to class 2016-11-24 13:22:25 +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
quotas.go move toMap function to be a method on the quota structs 2015-09-15 17:18:26 +08:00
search.go Major refactorings around searching, moved to seperate package, trying to move stuff out of models package, extend search support searching different types of entities and different types of dashboards, #960 2015-05-13 13:36:24 +02:00
star.go Added isStarred to search result hit, very inefficient loading right now but can be cached later on 2015-02-05 09:49:00 +01:00
stats.go stats: send amount of stars as stats 2018-01-23 22:51:05 +01:00
streams.go mergefix(): fixed issue with master merge 2017-01-31 09:00:36 +01:00
tags_test.go Create annotations (#8197) 2017-10-07 10:31:39 +02:00
tags.go Create annotations (#8197) 2017-10-07 10:31:39 +02:00
team_member.go teams: use orgId in all team and team member operations (#10862) 2018-02-09 17:26:15 +01:00
team.go teams: adds some validation to the API 2018-02-16 11:46:20 +01:00
temp_user.go signup: fix email sent logic for tempuser 2017-06-30 20:21:08 +02:00
test_data.go mysql: minor progress on response processing 2017-03-31 11:45:25 +02:00
user.go fix: viewers can edit now works correctly 2017-12-15 14:19:49 +01:00