Commit Graph

1268 Commits

Author SHA1 Message Date
Alexander Zobnin f976b690ca limit number of rows deleted by dashboard version cleanup 2018-03-21 20:26:27 +03:00
Alexander Zobnin fc2d1d6ca9 fix dashboard version cleanup on large datasets 2018-03-21 17:23:05 +03:00
Daniel Lee 1cef373d16 Merge remote-tracking branch 'upstream/master' into update-xorm 2018-03-20 19:21:58 +01:00
Daniel Lee 9cdd7cb04c database: expose SetConnMaxLifetime as config setting
For MySQL, setting this to be shorter than the wait_timeout MySQL setting
solves the issue with connection errors after the session has timed out for
the connection to the database via xorm.
2018-03-16 01:09:00 +01:00
Daniel Lee 5a3ba68a9c database: fixes after xorm update 2018-03-16 00:09:29 +01:00
Daniel Lee 1c20126f87 database: update xorm to v0.6.4 and xorm core to v0.5.7 2018-03-16 00:02:50 +01:00
Marcus Efraimsson ef3588c1f8 docker: mssql and mssql tests blocks with common build context 2018-03-15 09:49:53 +01:00
Marcus Efraimsson 57d46a706c mssql datasource: additional data type tests 2018-03-13 19:54:29 +01:00
Marcus Efraimsson d4beee2bb0 Merge branch 'master' into mssql_datasource 2018-03-13 16:03:02 +01:00
bergquist 061a418f0f style: dont expose func outside package 2018-03-13 11:24:10 +01:00
bergquist ff6108051d removes unused variables 2018-03-07 16:40:24 +01:00
Carl Bergquist 3f6e525755 Merge pull request #10942 from grafana/pausing_alerts_updates_timestamp
Pausing/un alerts now updates new_state_date
2018-03-07 15:40:12 +01:00
Daniel Lee 3b836c9c5f Merge pull request #10996 from grafana/snapshot_permissions
Snapshot fixes and changes to snapshot list
2018-02-23 09:17:59 +01:00
Daniel Lee fe49182b9d snapshots: fixes cleanup of old snapshots
Snapshot cleanup did not work due to time.Now syntax error. Added test
for it as well to catch any future errors.

Added error and debug logging so that it is possible to see any errors in the future.

Removed an unused configuration value and deprecated the remove expired snapshots
setting.
2018-02-22 16:12:16 +01:00
Marcus Efraimsson 3f588b4c48 dashboards: created/updated and createdby/updatedby should be set before save
If creating a new folder/dashboard created/updated and createdby/updatedby should always be set.
If updating an existing folder/dashboard updated and updatedby should always be set.
2018-02-22 11:54:28 +01: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
Marcus Efraimsson 02278f90a7 dashboards: make fake dashboard guardian available to other packages 2018-02-20 18:08:19 +01:00
Marcus Efraimsson 39aba03483 dashboards: created date should be set when creating a folder/dashboard 2018-02-20 13:54:31 +01:00
Marcus Efraimsson fce1e3f7f1 Merge branch 'master' into 10630_folder_api 2018-02-19 13:32:45 +01:00
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
Leonard Gram fe357a72d9 login: migration fix. 2018-02-16 17:36:28 +01:00
Leonard Gram 0053be9882 login: uses epochs for login throtting.
Closes #10937
2018-02-16 17:25:46 +01:00
Leonard Gram 1f3442020b alerts: refactoring tests 2018-02-16 14:37:10 +01:00
Leonard Gram c5226a945b alerting: pausing alerts modifies updated.
When pausing an alert the updated field is
modified to the current time.

Closes #10191
2018-02-16 14:24:52 +01:00
Torkel Ödegaard 8af2c9f1f8 test: added integration test for #10941 2018-02-16 14:17:41 +01:00
Torkel Ödegaard 5323971c21 refactoring: alert rule query refactoring (#10941) 2018-02-16 13:56:04 +01:00
bergquist 529fc022d5 db: reduce name column size in dashboard_provisoning
ref #10931
2018-02-16 11:49:17 +01:00
Daniel Lee b9d572bdec teams: adds some validation to the API 2018-02-16 11:46:20 +01:00
bergquist 56907eef69 tests: makes sure we all migrations are working 2018-02-14 15:30:29 +01:00
Leonard Gram fa1b92a12b provisioning: uses unix epoch timestamps. (#10907)
* provisioning: uses unix epoch timestamps.
2018-02-14 15:28:30 +01:00
Torkel Ödegaard fcaa8227a6 Dashboard acl query fixes (#10909)
* initial fixes for dashboard permission acl list query, fixes #10864

* permissions: refactoring of acl api and query
2018-02-14 15:04:26 +01:00
Torkel Ödegaard 73eaba076e wip: dashboard acl ux2, #10747 2018-02-14 15:03:22 +01:00
Torkel Ödegaard ec6f0f94b8 permissions: refactoring of acl api and query 2018-02-14 14:31:20 +01:00
bergquist 1a041a2250 bug: return correct err message
if the sql query failed has is false and the method will return
m.ErrDataSourceNotFound which is incorrect. We now return the
correct error message from the query

ref #10843
2018-02-14 13:32:52 +01:00
Torkel Ödegaard db89ac4134 initial fixes for dashboard permission acl list query, fixes #10864 2018-02-14 11:50:58 +01:00
Torkel Ödegaard 8dd4d505ee Merge branch 'dashboard-search-permissions-filter' 2018-02-14 10:48:55 +01:00
Leonard Gram b60b6690ba sql: removes locale from test to mirror prod. 2018-02-14 10:31:36 +01:00
bergquist fc371af47f adds tests that validate that updated is correct 2018-02-14 10:31:36 +01:00
Torkel Ödegaard 162439a8d6 fix: removed logging 2018-02-13 17:03:20 +01:00
Torkel Ödegaard e3c3f3ce4c fix: sql search permissions filter fix 2018-02-13 16:49:00 +01:00
Marcus Efraimsson cb8c82f7f6 Merge branch 'master' into 10630_folder_api 2018-02-12 15:14:41 +01:00
Leonard Gram 9a7eb5c327 Merge branch 'master' into provisioning 2018-02-12 14:19:20 +01:00
Marcus Efraimsson e1e0b5f951 teams: use orgId in all team and team member operations (#10862)
Also fixes issue in org users tests for postgres
2018-02-09 17:26:15 +01:00
Torkel Ödegaard 4d5a24a6c4 permissions: might have a solution for search 2018-02-09 17:24:34 +01:00
bergquist 59cd2d5102 provisioning: avoid caching and use updated field from db 2018-02-09 15:23:38 +01:00
Torkel Ödegaard e949eb3f58 Merge branch 'master' into dashboard-search-permissions-filter 2018-02-09 15:16:34 +01:00
Marcus Efraimsson a86f2fa34b user picker should only include users from current org (#10845) 2018-02-09 10:42:37 +01:00
Marcus Efraimsson 8921b0b517 db test: allow use of env variable for database engine to run tests for 2018-02-08 19:16:45 +01:00
Torkel Ödegaard 8e8f3c4332 dashboard and folder search with permissions 2018-02-08 17:11:01 +01:00
Leonard Gram 5a85fb6d32 Merge branch 'master' into provisioning 2018-02-08 13:43:19 +01:00