Commit Graph

76 Commits

Author SHA1 Message Date
Sofia Papagiannaki
11d8bcbea9
Guardian: Introduce additional constructors (#59577)
* Guardian: Use dashboard UID instead of ID

* Apply suggestions from code review

Introduce several guardian constructors and each time use
the most appropriate one.
2022-12-15 16:34:17 +02:00
Dominik Prokop
239888f229
Snapshots: Build snapshot originalUrl on the backend (#60232)
* Snapshots: Fix originalUrl spoof security issue

* Store relative URL only & validate UID

* use existing modal management tools

* Dummy commit to nudge CI

* Remove unused hooks file

* Fix import after backport

* Backport fixes

Co-authored-by: kay delaney <kay@grafana.com>
2022-12-13 05:48:54 -08:00
Gabriel MABILLE
d279b6d7b0
Fix: Allow creating snapshot with no dashboard id (#58669) 2022-11-29 09:29:27 +01:00
Gabriel MABILLE
c2c319146a
FIX: RBAC prevents deleting empty snapshots (#54385)
* FIX: RBAC prevents deleting empty snapshots

* Update pkg/api/dashboard_snapshot.go

Co-authored-by: Mihály Gyöngyösi <mgyongyosi@users.noreply.github.com>

* Simplify else case

Co-authored-by: Emil Tullsted <sakjur@users.noreply.github.com>

Co-authored-by: Mihály Gyöngyösi <mgyongyosi@users.noreply.github.com>
Co-authored-by: Emil Tullsted <sakjur@users.noreply.github.com>
2022-08-30 17:19:52 +02:00
idafurjes
a14621fff6
Chore: Add user service method SetUsingOrg and GetSignedInUserWithCacheCtx (#53343)
* Chore: Add user service method SetUsingOrg

* Chore: Add user service method GetSignedInUserWithCacheCtx

* Use method GetSignedInUserWithCacheCtx from user service

* Fix lint after rebase

* Fix lint

* Fix lint error

* roll back some changes

* Roll back changes in api and middleware

* Add xorm tags to SignedInUser ID fields
2022-08-11 13:28:55 +02:00
Sofia Papagiannaki
5fec6cc4f5
API: Fix snapshot responses (#52998)
* API: Fix response status when snapshots are not found

* API: Fix response status when snapshot key is empty

* Apply suggestions from code review
2022-08-03 10:31:23 -04:00
Sofia Papagiannaki
7ba076de10
Chore: Move swagger definitions to the handlers (#52643) 2022-07-27 09:54:37 -04:00
idafurjes
ee88b44458
Do not check permissions while deleting external snapshot (#51897) 2022-07-07 15:15:39 +02:00
Kristin Laemmert
9de00c8eb2
chore/backend: move dashboard errors to dashboard service (#51593)
* chore/backend: move dashboard errors to dashboard service

Dashboard-related models are slowly moving out of the models package and into dashboard services. This commit moves dashboard-related errors; the rest will come in later commits.

There are no logical code changes, this is only a structural (package) move.

* lint lint lint
2022-06-30 09:31:54 -04:00
Kristin Laemmert
72f934de01
backend/dashboardsnapshot service: move models (#50898)
* backend/dashboard snapshots: refactor leftover models and mocks
* Move all dashboard snapshot-related models into the dashboardsnapshotservice package
* Remove leftover dashboard-related mocks from the mockstore
2022-06-17 09:09:01 -04:00
idafurjes
8ab8ce609b
Bug: Fix delete dashboard snapshot for deleted dashboards (#50919)
* Bug: Fix delete dashboard snapshot for deleted dashboards

* Fix lint and make it work for all the errors

* Fix lint
2022-06-16 13:13:58 +02:00
Kristin Laemmert
08c7a54c47
backend/sqlstore split: move dashboard snapshot funcs to dashboardsnapshotservice (#50727)
* backend/sqlstore split: move dashboard snapshot funcs to dashboardsnapshotservice

This commit moves the dashboard snapshot related sql functions in the dashboardsnapshots service. I split the dashboards package up so the interfaces live in dashboarsnapshots and the store and service implementations are in their own packages. This took some minor refactoring, but none of the actual underlying code has changed, just where it lives.
2022-06-14 13:41:29 -04:00
ying-jeanne
7ddae870e7
fix status code 200 (#47818) 2022-04-15 08:01:58 -04:00
ying-jeanne
10b47480eb
add dashboardsnap as service of http server (#45461) 2022-02-17 09:31:26 +01:00
ying-jeanne
38f93d675b
dashboard snapshot bus removal (#44956) 2022-02-08 17:57:59 +01:00
idafurjes
8e6d6af744
Rename DispatchCtx to Dispatch (#43563) 2021-12-28 17:36:22 +01:00
idafurjes
c80e7764d8
Chore: Remove Dispatch and AddHandler (#42603)
* Remove Dispatch

* Remove context.TODO()

* Remove AddHandler and Dispatch
2021-12-02 18:08:59 +01:00
Serge Zaitsev
95831e9be0
Fix: Restore data binding in the create dashboard handler 2021-11-29 19:05:20 +01:00
Serge Zaitsev
57fcfd578d
Chore: replace macaron with web package (#40136)
* replace macaron with web package

* add web.go
2021-10-11 14:30:59 +02:00
Marcus Efraimsson
329f96db1a
Fix static path matching issue in macaron (#40023)
Co-authored-by: Malcolm Holmes <mdh@odoko.co.uk>
2021-10-05 19:38:09 +02:00
Marcus Efraimsson
518a0d0458
Chore: Propagate context for dashboard guardian (#39201)
Require guardian.New to take context.Context as first argument. 
Migrates the GetDashboardAclInfoListQuery to be dispatched using context.

Ref #36734

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: sam boyer <sam.boyer@grafana.com>
2021-09-23 17:43:32 +02:00
Serge Zaitsev
063160aae2
Chore: pass url parameters through context.Context (#38826)
* pass url parameters through context.Context

* fix url param names without colon prefix

* change context params to vars

* replace url vars in tests using new api

* rename vars to params

* add some comments

* rename seturlvars to seturlparams
2021-09-14 18:34:56 +02:00
Joan López de la Franca Beltran
6cfb640a0b
Chore: Refactor securedata to remove global encryption calls from dashboard snapshots (#38714)
* Add encryption service

* Add tests for encryption service

* Inject encryption service into http server

* Replace encryption global function usage in login tests

* Migrate to Wire

* Move Encryption bindings to OSS Wire set

* Chore: Refactor securedata to remove global encryption calls from dashboard snapshots

* Fix dashboard snapshot tests

* Remove no longer user test

* Add dashboard snapshots service tests

* Refactor service initialization

* Set up dashboard snapshots service as a background service

Co-authored-by: Tania B <yalyna.ts@gmail.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2021-09-01 13:05:15 +02:00
Marcus Efraimsson
b164c90e91
Chore: Fix http: superfluous response.WriteHeader error when deleting an external snapshot (#36780) 2021-07-15 15:29:52 +02:00
wengelbrecht-grafana
2fc9c6ca58
Fix key and deleteKey being ignored when creating a snapshot with external=true set (#33686)
* Update dashboard_snapshot.go

This is to address: https://github.com/grafana/grafana/issues/33665

The key and deleteKey fields are not honoured when creating a snapshot with external:true set

* removed whitespace
2021-05-13 15:39:43 -07:00
Owen Diehl
7a4ab13a79
API Response implements http.ResponseWriter (#32046)
* rename response.Header -> response.SetHeader to free up method name for http.ResponseWriter ifc

* normalresponse implements http.ResponseWriter
2021-03-17 13:12:28 -04:00
Hugo Häggmark
3d41267fc4
Chore: Moves common and response into separate packages (#30298)
* Chore: moves common and response into separate packages

* Chore: moves common and response into separate packages

* Update pkg/api/utils/common.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: changes after PR comments

* Chore: move wrap to routing package

* Chore: move functions in common to response package

* Chore: move functions in common to response package

* Chore: formats imports

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-01-15 14:43:20 +01:00
Arve Knudsen
c2cad26ca9
Chore: Disable default golangci-lint filter (#29751)
* Disable default golangci-lint filter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix linter warnings

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-15 09:32:06 +01:00
Agnès Toulet
d92beeee3d
API: add ID to snapshot API responses (#29600)
* API: add ID to snapshot API responses

* API: update snapshot tests
2020-12-04 16:22:58 +01:00
Arve Knudsen
cb62e69997
Chore: Convert API tests to standard Go lib (#29009)
* Chore: Convert tests to standard Go lib

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2020-11-13 09:52:38 +01:00
Arve Knudsen
3d3a7cbba8
Chore: Fix staticcheck issues (#28860)
* Chore: Fix issues reported by staticcheck

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Undo changes

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Chore: Fix issues reported by staticcheck

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix test

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 13:07:06 +01:00
Will Browne
ef22ff7315
Snapshots: Store dashboard data encrypted in the database (#28129)
* end 2 end

* fix import

* refactor

* introduce securedata

* check err

* use testify instead of convey

* cleanup test

* cleanup test

* blob time

* rename funcs
2020-10-13 10:19:42 +02:00
Carl Bergquist
3fdd2648b1
Chore: Avoid aliasing importing models in api package (#22492) 2020-03-04 12:57:20 +01:00
Arve Knudsen
35e0e078b7
pkg/util: Check errors (#19832)
* pkg/util: Check errors
* pkg/services: DRY up code
2019-10-23 10:40:12 +02:00
Oleg Gaidarenko
75fa1f0207 Metrics: use consistent naming for exported variables (#18134)
* Metrics: remove unused metrics

Metric `M_Grafana_Version` is not used anywhere, nor the mentioned
`M_Grafana_Build_Version`. Seems to be an artefact?

* Metrics: make the naming consistent

* Metrics: add comments to exported vars

* Metrics: use proper naming

Fixes #18110
2019-07-16 16:58:46 +02:00
zhulongcheng
7ebbeb09cb Snapshot: use given key and deleteKey (#16876)
Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-09 11:53:04 +02:00
bergquist
8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
Victor Cinaglia
48fe92a945 snapshots: Close response body after error check 2018-12-18 08:32:49 -05:00
Victor Cinaglia
411d67cae7
snapshots: Add support for deleting external snapshots 2018-12-10 18:47:23 -05:00
Victor Cinaglia
9d6da10e82
snapshots: Move external snapshot creation to backend 2018-12-10 16:36:32 -05:00
Dan Cech
417db13efb Fix dashboard snapshot deletion (#12025)
* fix issue deleting dashboard snapshots by deleteKey, add dedicated endopoint for authenticated requests, update frontend, tests & docs.
2018-05-24 08:55:16 +02:00
Julian Kornberger
0a415c50d0 Make golint happier 2018-03-22 22:38:44 +01:00
Julian Kornberger
7aab6a8887 Make golint happier 2018-03-22 12:40:21 +01:00
Dan Cech
c0ecdee375
rename Context to ReqContext 2018-03-07 11:54:50 -05:00
Dan Cech
338655dd37
move Context and session out of middleware 2018-03-06 18:16:49 -05:00
Daniel Lee
7d9a9fa29c snapshots: change to snapshot list query
Admins can see all snapshots. Other roles can only see their own
snapshots.

Added permission check for deleting snapshots - admins can delete
any snapshot, other roles can delete their own snapshots or
snapshots that they have access to via dashboard permissions.
2018-02-21 13:39:08 +01:00
bergquist
2de94d6548 convert old metrics to prom metrics 2017-09-14 14:26:32 +02:00
bergquist
51de894692 fix(snapshots): sets default value for snapshot name
make it possible for < 3.0 instances to publish snapshots

ref #4778
2016-04-21 09:59:48 +02:00
Torkel Ödegaard
0398face05 feat(plugins): dashboard import for data sources is working! #4298 2016-03-12 10:13:49 +01:00
utkarshcmu
aa1d28835d Fixed angularjs variable names 2016-01-19 23:23:44 -08:00