Commit Graph

41 Commits

Author SHA1 Message Date
juanicabanas
48120f2594
PublicDashboards: Delete public dashboard in public dashboard table (#57766)
PublicDashboards: delete button added in public dashboard table in order to delete a public dashboard.

Co-authored-by: Jeff Levin <jeff@levinology.com>
2022-10-31 17:16:07 -04:00
Ezequiel Victorero
46093c1267
PublicDashboards: do not return errors when resource not found from store layer (#57838) 2022-10-31 11:22:27 -03:00
Jeff Levin
bf672f960a
public dashboards: rename api functions (#57789)
This PR imposes better naming conventions on public dashboards api

* rename api functions and remove use of _config_ noun

* fix tests

Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
2022-10-27 17:08:11 -08:00
Jeff Levin
6b7d6fe0cb
public dashboards: rename route paths (#57787)
This PR fixes the naming of routes for public dashboards to be more accurate and descriptive.

Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
2022-10-27 14:41:56 -08:00
Ezequiel Victorero
860380d893
PublicDashboards: refactor following naming convention for services (#57625) 2022-10-25 21:40:42 -03:00
Ezequiel Victorero
1f3d34ecda
PublicDashboards: service and store methods rename (#57463) 2022-10-21 18:25:20 -03:00
Ezequiel Victorero
5b9959014c
PublicDashboards: refactor service (#57372) 2022-10-21 09:37:38 -03:00
lean.dev
552d9d70eb
PublicDashboards: Validate access token (#57298)
Adding validation for access token
2022-10-20 16:43:33 -03:00
Ezequiel Victorero
3e6bdf0439
PublicDashboards: filter by permissions on audit list (#57228) 2022-10-19 17:24:00 -03:00
Kristin Laemmert
05709ce411
chore: remove sqlstore & mockstore dependencies from (most) packages (#57087)
* chore: add alias for InitTestDB and Session

Adds an alias for the sqlstore InitTestDB and Session, and updates tests using these to reduce dependencies on the sqlstore.Store.

* next pass of removing sqlstore imports
* last little bit
* remove mockstore where possible
2022-10-19 09:02:15 -04:00
owensmallwood
b2408dd7c5
Publicdasboards: Add annotations support (#56413)
adds annotations support for public dashboards
2022-10-18 19:48:20 -06:00
Misi
9c954d06ab
Auth: Refresh OAuth access_token automatically using the refresh_token (#56076)
* Verify OAuth token expiration for oauth users in the ctx handler middleware

* Use refresh token to get a new access token

* Refactor oauth_token.go

* Add tests for the middleware changes

* Align other tests

* Add tests, wip

* Add more tests

* Add InvalidateOAuthTokens method

* Fix ExpiryDate update to default

* Invalidate OAuth tokens during logout

* Improve logout

* Add more comments

* Cleanup

* Fix import order

* Add error to HasOAuthEntry return values

* add dev debug logs

* Fix tests

Co-authored-by: jguer <joao.guerreiro@grafana.com>
2022-10-18 18:17:28 +02:00
Jeff Levin
7146f2731c
Public Dashboards: audit log paths and add traceId where user facing error is different (#56914)
Audit all paths for publicdashboards and implement traces where user facing error is different from the internal error.
2022-10-17 13:17:24 -08:00
Kristin Laemmert
c61b5e85b4
chore: replace sqlstore.Store with db.DB (#57010)
* chore: replace sqlstore.SQLStore with db.DB

* more post-sqlstore.SQLStore cleanup
2022-10-14 15:33:06 -04:00
Jeff Levin
cc27214dca
Public Dashboards: Add audit table (#54508)
This PR adds an audit table for public dashboards allowing a user to view all public dashboards on an instance of grafana. The public dashboards team is working on a proposal for adding RBAC support to the audit table for 9.3

Co-authored-by: juanicabanas <juan.cabanas@grafana.com>
2022-10-12 21:36:05 -08:00
Jeff Levin
331110bde5
refactor public dashboards middleware testing (#55706)
This PR refactors how we add the orgId to the context on a public dashboard paths. We also split out accessToken handling into its own package and rework status code for "RequiresValidAccessToken". We will be modeling all endpoints to use these status codes going forward. Additionally, it includes a scaffold for better middleware testing and refactors existing tests to table drive tests.
2022-10-06 12:35:19 -08:00
ying-jeanne
2472777ce2
Chore: implement sqlx into tag service (#55908)
* add sqlx store to tag service

* add sqlx into tag service

* fix test

* change to camal cases

* change in xorm camal case
2022-09-28 08:23:40 -04:00
Guilherme Caulada
9c2f3045b4
PublicDashboards: Resolve interval for public dashboard data source (#55489)
* Resolve interval for public dashboard data source

* Remove type assertions in favor of 'in'

* Add org id to public dashboard requests
2022-09-21 13:29:27 -03:00
ying-jeanne
7b4cea8151
Chore: StoreSplit tag service (#55453)
* move tag service outside

* fix dashboard

* fix test

* lint

* fix linter

* remove spew
2022-09-21 08:04:01 -04:00
ying-jeanne
e4741ce8d6
remove datasource from sqlstore (#55288) 2022-09-16 06:20:26 -04:00
owensmallwood
e37420f0a8
PublicDashboards: Log api layer errors and which datasources fail/succeed (#55056)
Adds pubdash api error logging and logs array of datasource names with success status when running pubdash queries.
2022-09-14 13:19:21 -06:00
Emil Tullstedt
b287047052
Chore: Upgrade Go to 1.19.1 (#54902)
* WIP

* Set public_suffix to a pre Ruby 2.6 version

* we don't need to install python

* Stretch->Buster

* Bump versions in lib.star

* Manually update linter

Sort of messy, but the .mod-file need to contain all dependencies that
use 1.16+ features, otherwise they're assumed to be compiled with
-lang=go1.16 and cannot access generics et al.

Bingo doesn't seem to understand that, but it's possible to manually
update things to get Bingo happy.

* undo reformatting

* Various lint improvements

* More from the linter

* goimports -w ./pkg/

* Disable gocritic

* Add/modify linter exceptions

* lint + flatten nested list

Go 1.19 doesn't support nested lists, and there wasn't an obvious workaround.
https://go.dev/doc/comment#lists
2022-09-12 12:03:49 +02:00
Karl Persson
bcd7afd1f5
RBAC: Remove service dependency in Evaluator component (#54910)
* RBAC: Remove service dependency for Evaluator component

* RBAC: Add service and load permissions in target org if they are not
there

* RBAC: Use service if we need to load permissions for org

* API: remove service injection into evaluator

* API: set new user for each request in tests

* PublicDashboards: Use fake service to provide permissions

* RBAC: Set org id for dashboard provisioning user
2022-09-09 09:07:45 +02:00
Ezequiel Victorero
bcab0194f1
PublicDashboards: disable form if user does not has permissions (#54853) 2022-09-07 18:29:01 -03:00
owensmallwood
108678a8cc
Public Dashboards: Only use queries from dashboard for caching (#54596)
Don't accept frontend queries for query caching when its from a public dashboard. Use queries on the dashboard instead.
2022-09-07 12:08:52 -06:00
Karl Persson
ff35e35ce0
RBAC: Move service and evaluator to acimpl package (#54714)
* RBAC: Move access control evaluator to acimpl package

* RBAC: Move service to acimpl package
2022-09-05 18:15:47 +02:00
Ezequiel Victorero
bfa35ff8d8
PublicDashboards: Add RBAC to secured endpoints (#54544) 2022-09-05 12:22:39 -03:00
Ezequiel Victorero
722aca5c53
Public Dashboards: use intervalMs and maxDataPoints from request (#53613) 2022-08-29 18:13:06 -03:00
Jeff Levin
5cb9fca990
public-dashboards: Add log statement when public dashboard enabled or disabled (#54133)
* refactor apis for consistent outputs
* add dashboardUid validation at API layer
* add check for empty dashboardUid on SavePublicDashboard
* remove public dashboard errors from models package.

Co-authored-by: Ezequiel Victorero <evictorero@gmail.com>
2022-08-26 11:28:54 -08:00
Jeff Levin
681bdf1a2d
public-dashboards: refactor query method (#54119)
This PR refactors the GetPublicDashboard method so we don't need to make extra database calls. Also adds general documentation
2022-08-26 05:21:52 -04:00
Karl Persson
55c7b8add2
RBAC: Split up service into several components (#54002)
* RBAC: Rename interface to Store

* RBAC: Move ranme scopeInjector

* RBAC: Rename files to service

* RBAC: Rename to service

* RBAC: Split up accesscontrol into two components

* RBAC: Add DeclareFixedRoles to AccessControl interface

* Wire: Fix wire bindings

* RBAC: Move resolvers to root

* RBAC: Remove invalid test

* RBAC: Inject access control service

* RBAC: Implement the RoleRegistry interface in fake
2022-08-24 13:29:17 +02:00
Karl Persson
d1df896962
Remove unsued dep (#53785) 2022-08-16 17:33:24 +02:00
Karl Persson
c08fe3a53c
RBAC: Enable rbac when creating new settings (#53531)
* Settings: Set RBACEnabled to true by default

* Remove accessControlEnabledFlag and explicitly set to false when needed

* Disable rbac for tests
2022-08-11 15:37:31 +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
Guilherme Caulada
7554322327
Fix middleware tests for public dashboards (#53557) 2022-08-10 17:12:25 -04:00
owensmallwood
dc23643bee
Public Dashboards: Usage Insights (#52768) 2022-08-10 14:14:48 -03:00
idafurjes
6afad51761
Move SignedInUser to user service and RoleType and Roles to org (#53445)
* Move SignedInUser to user service and RoleType and Roles to org

* Use go naming convention for roles

* Fix some imports and leftovers

* Fix ldap debug test

* Fix lint

* Fix lint 2

* Fix lint 3

* Fix type and not needed conversion

* Clean up messages in api tests

* Clean up api tests 2
2022-08-10 11:56:48 +02:00
Alexander Emelin
e791a4e576
Search: Move entity events to transaction (#52394) 2022-08-01 18:56:36 +03:00
owensmallwood
cf86c696e0
Public Dashboards: Adds template variable validation for pubdash on the backend (#52566)
Validates template variables for pubdash on the backend when saving a public dashboard
2022-07-21 13:56:20 -06:00
Ezequiel Victorero
e0a58300ac
Public Dashboards: count public dashboards view requests (#52419) 2022-07-19 11:50:37 -03:00
Jeff Levin
eacee08135
public dashboards: move into into its own service (#51358)
This PR moves public dashboards into its own self contained service including API, Service, Database, and Models. Routes are mounted on the Grafana HTTPServer by the API service at injection time with wire.go. The main  route that loads the frontend for public dashboards is still handled by the API package.

Co-authored-by: Jesse Weaver <jesse.weaver@grafana.com>
Co-authored-by: Owen Smallwood <owen.smallwood@grafana.com>
2022-07-06 17:51:44 -06:00