1305 Commits

Author SHA1 Message Date
a2bbd89a9e adding updated column 2018-03-22 15:52:09 +01:00
df94b380f4 Merge remote-tracking branch 'grafana/master' into annotations-created
* grafana/master:
  Make golint happier
2018-03-22 14:59:14 +01:00
7aab6a8887 Make golint happier 2018-03-22 12:40:21 +01:00
3898ea02e6 adding created column 2018-03-22 02:22:58 +01:00
1cef373d16 Merge remote-tracking branch 'upstream/master' into update-xorm 2018-03-20 19:21:58 +01:00
3ca1e06509 session: fork Macaron mysql session middleware
This changes forks the mysql part of the Macaron session middleware.

In the forked mysql file:

- takes in a config setting for SetConnMaxLifetime (this solves wait_timeout
problem if it is set to a shorter interval than wait_timeout)
- removes the panic when an error is returned in the Exist function.
- retries the exist query once
- retries the GC query once
2018-03-16 01:19:28 +01:00
5669596518 add regex search of username and password in urls, which are replaced by strings.Replace 2018-03-15 10:50:57 +01:00
5fbfd67b94 dashboards: should be possible to browse dashboard using only uid
That is, the slug part of url should be optional.
Closes #11231
2018-03-13 21:06:25 +01:00
3f2c086e6f teams: removes quota on route
Got added by mistake a year ago.
2018-03-13 10:56:35 +01:00
a83ede0193 support POST for query and query_range 2018-03-12 13:25:05 +09:00
bbd6adabbf move quota to dedicated service 2018-03-07 17:19:35 -05:00
c0ecdee375 rename Context to ReqContext 2018-03-07 11:54:50 -05:00
338655dd37 move Context and session out of middleware 2018-03-06 18:16:49 -05:00
5934521137 fixes invalid link to profile pic when gravatar is disabled
closes #11097
2018-03-06 11:46:50 +01:00
3d4e99d8be Merge pull request #11040 from grafana/permission-checks
Add permission check for dashboard diff api route
2018-02-28 18:23:39 +01:00
ecf438f8d0 dashboard: add permission check for diff api route
ref #10770
2018-02-27 17:53:30 +01:00
f76b98d252 dashboards: change dashboard/folder permission error messages 2018-02-27 16:04:45 +01:00
03f8eff880 dashboards: handle new guardian error responses and update tests
Using a mocked guardian instead and relies on the actual guardian tests for verifying
permission handling correctness
2018-02-27 16:04:45 +01:00
3c14cecd50 folders: handle new guardian error responses and add tests 2018-02-27 16:04:45 +01:00
3b836c9c5f Merge pull request #10996 from grafana/snapshot_permissions
Snapshot fixes and changes to snapshot list
2018-02-23 09:17:59 +01:00
3f3175972e dashboards: fix batch dashboard/folder delete response
Use message returned from backend and use that as alert success response to user
2018-02-21 16:38:09 +01:00
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
9889c92083 fix typos in api, acl to permissions 2018-02-21 11:50:32 +01:00
3df8ae2306 folders: rename folder_acl in api to folder_permission 2018-02-21 11:45:19 +01:00
d68099bc4a dashboards: change api route for dashboard permissions
From /api/dashboards/id/:id/acl to /api/dashboards/id/:id/permissions
2018-02-21 11:42:54 +01:00
a167e19b37 folders: folder api tests 2018-02-21 11:24:54 +01:00
417541c77f folders: folder permissions api tests 2018-02-20 18:11:50 +01:00
892bdecb19 folders: folder permission api routes 2018-02-20 15:25:16 +01:00
717d8d0c45 folders: fix api error mapping 2018-02-20 15:01:20 +01:00
ea7998ca8e folders: use new folder service in folder api routes 2018-02-20 13:57:32 +01:00
fce1e3f7f1 Merge branch 'master' into 10630_folder_api 2018-02-19 13:32:45 +01:00
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
5323971c21 refactoring: alert rule query refactoring (#10941) 2018-02-16 13:56:04 +01:00
b9d572bdec teams: adds some validation to the API 2018-02-16 11:46:20 +01:00
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
8dd4d505ee Merge branch 'dashboard-search-permissions-filter' 2018-02-14 10:48:55 +01:00
cb8c82f7f6 Merge branch 'master' into 10630_folder_api 2018-02-12 15:14:41 +01:00
9a7eb5c327 Merge branch 'master' into provisioning 2018-02-12 14:19:20 +01:00
12a6de7461 dashboard: always make sure dashboard exist in dashboard acl http api (#10856) 2018-02-12 09:26:09 +01:00
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
e949eb3f58 Merge branch 'master' into dashboard-search-permissions-filter 2018-02-09 15:16:34 +01:00
a86f2fa34b user picker should only include users from current org (#10845) 2018-02-09 10:42:37 +01:00
8e8f3c4332 dashboard and folder search with permissions 2018-02-08 17:11:01 +01:00
5a85fb6d32 Merge branch 'master' into provisioning 2018-02-08 13:43:19 +01:00
0e8377a9f4 Update logic for create/update dashboard, validation and plugin dashboard links (#10809)
* enables overwrite if dashboard allready exist in folder

* dashboard: Don't allow creating a folder named General

* dashboards: update logic for save/update dashboard

No id and uid creates a new dashboard/folder.
No id and uid, with an existing title in folder allows overwrite
  of dashboard.
Id without uid, allows update of existing dashboard/folder without
  overwrite.
Uid without id allows update of existing dashboard/folder without
  overwrite.
Id without uid, with an existing title in folder allows overwrite
  of dashboard/folder and updated will have the uid of overwritten.
Uid without id, with an existing title in folder allows overwrite
  of dashboard/folder and new will have the same uid as provided.
Trying to change an existing folder to a dashboard yields error.
Trying to change an existing dashboard to a folder yields error.

* dashboards: include folder id when confirmed to save with overwrite

* dashboards: fixes due to new url structure

Return importedUrl property in response to importing dashboards and
getting plugin dashboards and use this for redirects/links in the
frontend.
2018-02-08 12:48:38 +01:00
b549d29319 Merge branch 'master' into provisioning 2018-02-08 11:01:09 +01:00
0e61a670bb fix: error handling now displays page correctly, fixes #10777 2018-02-06 12:28:17 +01:00
2d1bd270fb Stale permissions (#10768)
* dashfolders: hide permissions in settings if folder has changed

and the dashboard has not been saved yet. Otherwise the use will
see stale permissions from the original folder.

* dashfolders: return folder url for inherited permissions
2018-02-05 14:28:24 +01:00
55100d5ff9 Merge pull request #10760 from grafana/10749_link_to_folder
Fix link to folder from permissions list
2018-02-05 11:34:59 +01:00
7d3b990e91 permissions: fix link to folder from permissions list
Also, closing Add Permissions CTA when DashboardPermissions and
FolderPermissions unmounts.
Fixes #10749"
2018-02-05 11:10:37 +01:00