Commit Graph

3511 Commits

Author SHA1 Message Date
Torkel Ödegaard
ed128ea964
Frontend: Foundations for multi tenant frontend (#78815)
* Frontend: Foundations for multi tenant frontend

* improve manifest parsing for multi-tenant frontend (#78876)

* add test

* add test

* ??

* Updates

* Added cache

* test cleanup

* lint

* fix test

* fix error templates

* cleanup

* remove copy

* revert changes to list testdata

* comment cleanup

* prepare integration tests

* Remove integrety

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-12-05 08:34:22 +01:00
Todd Treece
38bc41651a
K8s: Refactor metrics to share k8s registry (#77957)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-12-04 10:54:59 -08:00
Gabriel MABILLE
5b70130e6c
Plugins: Rename externalServiceAuthentication to iam (#78686)
Plugins: Rename externalServiceAuthentication to iam
2023-12-04 13:14:21 +01:00
Sofia Papagiannaki
6d4625ad52
Alerting: Fix deleting rules in a folder with matching UID in another organization (#78258)
* Remove usage of obsolete function for deleting alert rules under folder

* Apply suggestion from code review

* Update tests
2023-12-04 11:34:38 +02:00
Ieva
c354c7bfff
RBAC: Update fixed annotation roles (#78756)
* update fixed annotation roles if FlagAnnotationPermissionUpdate is enabled

* add dashboard type scope back in the fixed roles to make the migration easier
2023-12-01 14:50:55 +00:00
Gabriel MABILLE
ef2c79d22a
Chore: use errutil for pluginRepo errors (#78647)
* Chore: use errutil for pluginRepo errors

* Update pkg/util/errutil/status.go

* Use errutil helper functions

Co-Authored-By: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* Forgot the log level

* Use entity

---------

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2023-11-30 15:49:27 +01:00
Eric Leijonmarck
59bdff0280
Auth: Add anonymous users view and stats (#78685)
* Add anonymous stats and user table

- anonymous users users page
- add feature toggle `anonymousAccess`
- remove check for enterprise for `Device-Id` header in request
- add anonusers/device count to stats

* promise all, review comments

* make use of promise all settled

* refactoring: devices instead of users

* review comments, moved countdevices to httpserver

* fakeAnonService for tests and generate openapi spec

* do not commit openapi3 and api-merged

* add openapi

* Apply suggestions from code review

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>

* formatin

* precise anon devices to avoid confusion

---------

Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
Co-authored-by: jguer <me@jguer.space>
2023-11-29 17:58:41 +01:00
venkatbvc
e152323a33
Auth: Split signout_redirect_url into per provider settings (#75269)
* Split signout_redirect_url into per provider settings

* Split signout_redirect_url into per provider settings

* Update docs/sources/setup-grafana/configure-security/configure-authentication/grafana/index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Split signout_redirect_url into per provider settings

* Split signout_redirect_url into per provider settings

* Split signout_redirect_url into per provider settings

* Split signout_redirect_url into per provider settings

* Split signout_redirect_url into per provider settings

* Split signout_redirect_url into per provider settings

* update docs

* update devenvs

* add missing struct tag

---------

Co-authored-by: Rao, B V Chalapathi <b_v_chalapathi.rao@nokia.com>
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: jguer <me@jguer.space>
2023-11-29 14:50:21 +01:00
Ieva
d201d3f7db
RBAC: correctly fetch nested folder metadata (#78655)
fix a bug with nested folder metadata
2023-11-28 09:28:47 +00:00
Todd Treece
529271d7a8
Perf: Disable core kind registry (#78568)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-11-28 09:09:54 +01:00
Gabriel MABILLE
24a6ee4a91
Plugins: Check installer's permissions include plugins' permissions (#78211)
* Check installer perm

* Failed eval better output

* Switch fetching json data in the repo

* Comment

* Account for feedback

* Mv single_organization config option

* Inline error check

* Starting to replace errors not to have to do the management in two places

* Continue error translation

* Cover ErrChecksumMismatch

* Refactor a bit

* Lint. Tab

* log instead of erroring out

* Nit.

* Revert change on kinds

* revert file again

* Fix tests

* Match core plugin error status code

* Skip permission check for Grafana Admin

* Use errutil templates

* Use errutil templating

* Inline

* Test templating

* revert error changes

* Remove isGrafanaAdmin skip

* Feature toggle check

* Small refactor on hasPluginRequestedPermissions

* Add test

* Imports

* Post install check

* change log messages so that they make sense

* Cover no scope case

* Inline

* Nit.

* Fix test
2023-11-24 16:02:44 +01:00
Jo
7d559bc69a
AuthProxy: Do not allow sessions to be assigned with other methods (#78602)
do not allow login token with other methods
2023-11-24 11:00:53 +01:00
Misi
7128415529
Auth: Add more context to logs around token rotation, revocation (#78600)
Add more context to logs around token rotation, revocation

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2023-11-23 16:48:54 +01:00
Ieva
778841cabe
Annotations: Remove dashboard permission checks for annotations (#78352)
remove checks for access to dashboard if FlagAnnotationPermissionUpdate is enabled
2023-11-23 10:47:37 +00:00
Jo
0de66a8099
Authz: Remove use of SignedInUser copy for permission evaluation (#78448)
* remove use of SignedInUserCopies

* add extra safety to not cross assign permissions

unwind circular dependency

dashboardacl->dashboardaccess

fix missing import

* correctly set teams for permissions

* fix missing inits

* nit: check err

* exit early for api keys
2023-11-22 14:20:22 +01:00
Juan Cabanas
9c5daed336
PublicDashboards: Middleware creation (#77941) 2023-11-21 17:56:36 -03:00
Gabriel MABILLE
b6b86bb0b3
RBAC: Check plugins:install globally (#78438)
* RBAC: Check plugins:install globally

* Add disclamer to the RBACSingleOrganization config option
2023-11-21 15:09:43 +01:00
Karl Persson
1eb19befaa
Login: refactor auth info package (#78459)
* Remove unused stats and metrics

* No longer collect metrics

* Remove unused dependency

* Move database from sub package
2023-11-21 14:47:23 +01:00
Karl Persson
d42201dbf4
Login: remove unused function (#78442)
* Move test to the db so we test the queries and not just testing the mock

* Remove unused function and dependencies

* Remove unused functions from the database

* Add some integration tests
2023-11-21 11:44:13 +01:00
Kat Yang
2f2ce3edbb
Chore: Deprecate ID from Folder (#78281)
* Chore: Deprecate ID from Folder

* chore: add more linter comments

* chore: add missing lint comment
2023-11-20 15:44:51 -05:00
Ashley Harrison
7404ed66f6
Chore: Remove navAdminSubsections toggle (#78179)
* remove navAdminSubsections toggle

* missed one!
2023-11-17 10:04:34 +00:00
Ieva
2a5547e1b5
Annotations: Update annotation scope resolver to resolve annotation scopes to dash and folder scopes (#78222)
* update annotation scope resolver to resolve dashboard annotation scopes to dash and folder scopes

* Update annotations.go

remove unwanted changes

* remove unwanted change

* use switch statement
2023-11-17 11:57:25 +02:00
Kat Yang
2d09bac2b8
Chore: Deprecate FolderIDs only used by Swagger (#78219) 2023-11-16 09:57:04 -05:00
Ieva
b0448b92e5
Dashboards: Allow updating a dashboard if the user doesn't have access to the parent folder (#78075)
* change where folder checks are done for dash creation/updates

* add test for folder not being found

* test fixes

* more test fixes

* add nlint directive to where folder IDs are used

* fix bad merge

* fix test
2023-11-16 11:11:35 +00:00
Ieva
2c73f15839
Revert "Revert "RBAC: remove dashboard ACL logic from dash store, service #78130" (#78203)
Revert "Revert "RBAC: remove dashboard ACL logic from dash store, service #78130 (#78198)"

This reverts commit 8057b9298d.
2023-11-15 16:45:49 +00:00
Kat Yang
d090dab138
Chore: Deprecate FolderID from SaveDashboardCommand (#77813) 2023-11-15 11:21:02 -05:00
Kat Yang
8d581b8358
Chore: Deprecate ID in GetFolderQuery (#77647) 2023-11-15 10:30:00 -05:00
Kat Yang
a640d9d395
Chore: Deprecate Id from Folder in DTOs (#77943)
* Chore: Deprecate Id from Folder in DTOs

* chore: regen spec
2023-11-15 10:29:49 -05:00
Kat Yang
ae326eaed1
Chore: Deprecate FolderID from DashboardACLInfoDTO (#77652)
* Chore: Deprecate FolderID from DashboardACLInfoDTO

* chore: regen specs
2023-11-15 10:29:20 -05:00
Kat Yang
3a2e96b0db
Chore: Deprecate FolderID from Dashboard (#77823)
* Chore: Deprecate FolderID from Dashboard

* chore: add two missing nolint comments
2023-11-15 10:28:50 -05:00
Ryan McKinley
b8e8d84ef7
Swagger: Show k8s APIs (#78091) 2023-11-15 06:42:35 -08:00
Eric Leijonmarck
8057b9298d
Revert "RBAC: remove dashboard ACL logic from dash store, service #78130 (#78198)
Revert "RBAC: remove dashboard ACL logic from dash store and service (#78130)"

This reverts commit dd54931147.
2023-11-15 15:33:38 +02:00
Ieva
dd54931147
RBAC: remove dashboard ACL logic from dash store and service (#78130)
remove dashboard ACL logic from dash store and service
2023-11-15 08:25:51 +00:00
Ryan McKinley
f69fd3726b
FeatureToggles: Add context and and an explicit global check (#78081) 2023-11-14 12:50:27 -08:00
Ryan McKinley
ea37a116f7
K8s: expose namespace in frontend_settings (#78090)
Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com>
2023-11-14 06:34:09 +02:00
Ryan McKinley
dec9a07738
Settings: Actually deprecate access to feature flags (#78073) 2023-11-13 11:39:01 -08:00
Ryan McKinley
3509a5abb9
FeatureFlags: Cleanup usage of cfg.IsFeatureToggleEnabled (#78014) 2023-11-13 07:55:15 -08:00
Ieva
eca45f6492
Chore: remove gcomOnlyExternalOrgRoleSync feature toggle (#78001)
remove gcomOnlyExternalOrgRoleSync feature toggle
2023-11-13 09:56:02 +00:00
Hugo Kiyodi Oshiro
e754c5a6c6
Plugins: Change managed plugins installation call (#77120) 2023-11-10 12:28:36 +01:00
Will Browne
7d2d5fbe89
Plugins: Add referer and user login params to plugin CDN redirect logs (#77942)
add referer and user
2023-11-10 11:52:06 +01:00
Giuseppe Guerra
da117aea1c
Plugins: Allow disabling angular deprecation UI for specific plugins (#77026)
* Plugins:Allow disabling angular deprecation UI for specific plugins

* add backend test

* changed test names

* lint

* Removed angular properties from DataSourceDTO

* Update tests

* Move angularDetected and hideAngularDeprecation in angularMeta property

* Fix angular property name in AppPluginConfig

* Fix reference to angularMeta.detected

* Fix hide_angular_deprecation not working for core plugins

* lint
2023-11-10 11:44:54 +01:00
Agnès Toulet
bb12fe7d82
UsageInsights: Disable frontend features when backend is disabled (#77772)
* UsageInsights: Disable frontend features when backend is disabled

* Disable DS insights

* Update doc

* fix linter issue

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

---------

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2023-11-09 11:53:20 +01:00
Ryan McKinley
4b5310dae7
Playlists: Merge the frontend vs backend k8s feature flags (#77875) 2023-11-08 21:14:05 +02:00
Eric Leijonmarck
c13fd62b16
Team LBAC: Add permission check for Update datasource (#77709)
* add permission check for updating the LBAC Rules

* permission scoped for id in the updating datasource

* fixed test to cover for permissions

* fix proper check for permissions and empty teamHTTPHeader requests

* check for jsondata

* check nil for jsondata inside the getEncodedString
2023-11-08 14:37:32 +00:00
Alexander Zobnin
a39242890e
Folders: Able to fetch folders available for user as "shared" folder (#77774)
* Folders: Show folders user has access to at the root level

* Refactor

* Refactor

* Hide parent folders user has no access to

* Skip expensive computation if possible

* Fix tests

* Fix potential nil access

* Fix duplicated folders

* Fix linter error

* Fix querying folders if no managed permissions set

* Update benchmark

* Add special shared with me folder and fetch available non-root folders on demand

* Fix parents query

* Improve db query for folders

* Reset benchmark changes

* Fix permissions for shared with me folder

* Simplify dedup

* Add option to include shared folder permission to user's permissions

* Fix nil UID

* Remove duplicated folders from shared list

* Only left the base part

* Apply suggestions from code review

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* Add tests

* Fix linter errors

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-11-08 15:28:49 +01:00
Kat Yang
a5044fe6db
Chore: Deprecate FolderIds in Query (#77624)
Chore: Deprecate FolderID in Query
2023-11-07 09:51:44 -05:00
Kat Yang
6ed09de47d
Chore: Deprecate FolderId in DashboardMeta (#77626)
* Chore: Deprecate FolderId in DashboardMeta

* chore: regen specs
2023-11-06 11:31:44 -05:00
Sofia Papagiannaki
f999fe3d12
Search: Modify query for better performance (#77576)
* Add missing `org_id` in query condition

* Update benchmarks
2023-11-06 15:16:23 +02:00
Ryan McKinley
549787d4f9
Playlist: Implement the entire API with k8s client (#77596) 2023-11-03 09:25:29 -07:00
João Calisto
ade140c161
Feature Management: Define HideFromAdminPage and AllowSelfServe configs (#77580)
* Feature Management: Define HideFromAdminPage and AllowSelfServe configs

* update tests

* add constraint for self-serve

* Update pkg/services/featuremgmt/models.go

Co-authored-by: Michael Mandrus <41969079+mmandrus@users.noreply.github.com>

---------

Co-authored-by: Michael Mandrus <41969079+mmandrus@users.noreply.github.com>
2023-11-03 15:59:07 +00:00
Ryan McKinley
35c1ee9686
EntityStore: Remove http access (can use apiserver now) (#77602) 2023-11-03 08:14:51 -07:00
Ryan McKinley
dd654fdc87
K8s/Playlist: Refactor apis packages so the types and registry are in different packages (#77586) 2023-11-03 08:07:55 -07:00
Alexander Zobnin
225a69ba02
Team LBAC: Fix backend validation (#77612)
* Team LBAC: Fix backend validation

* more tests

* use slices.ContainsFunc()
2023-11-03 17:02:57 +03:00
Vardan Torosyan
d624a5d490
Chore: Replace grafana-authnz-team with identity-access-team as code owners (#77609)
* Chore: Replace grafana-authnz-team with identity-access-team as code owner

* Chore: Replace grafana-authnz-team with identity-access-team as code owner

* Fix the failing test
2023-11-03 13:20:39 +01:00
Ryan McKinley
45d59cf31b
Dashboards: Remove dummy trim dashboard api (#77249)
Co-authored-by: nikimanoledaki <niki.manoledaki@grafana.com>
2023-11-02 08:35:14 -07:00
Ryan McKinley
5d5f8dfc52
Chore: Upgrade Go to 1.21.3 (#77304) 2023-11-01 09:17:38 -07:00
Sofia Papagiannaki
dfc33a70b7
Dashboards: Fix creating dashboard under folder using deprecated API (#77501)
* Dashboards: Add integration tests for creating a dashboard

* Fix creating dashboard under folder using deprecated API

* Update swagger response

* Fix comments
2023-11-01 17:01:54 +02:00
Todd Treece
384f5ccdc6
Playlist: Add internal API version (#77318) 2023-11-01 09:44:04 -04:00
Ryan McKinley
dd773e74f1
K8s: Implement playlist api with k8s client (#77405) 2023-10-31 10:26:39 -07:00
Kyle Brandt
e4d1fdc3d0
Errors: Make errors the same in dev as prod (#77366)
When running in dev mode, error messages would contain an additional "error" property alongside "message". Since this causes confusion, that has been removed and now error messages are the same both modes (using "message").
2023-10-30 14:06:26 -04:00
Ezequiel Victorero
16034ef062
PublicDashboards: Add swagger documentation (#75318) 2023-10-30 10:32:07 -03:00
Karl Persson
87eba34745
User: remove empty email / username check from update in service (#77347)
User: remove empty email / username check from update in service
2023-10-30 10:44:26 +01:00
Eric Leijonmarck
57335cb173
Team LBAC: Add validation/regex of teamheaders (#76905)
* add validation of team header values w. regex

* apply valid headers

* refactor testcases to account for badly formatted json

* refactoring to move validation code close to the validation itself

* removed tes

* Update pkg/api/datasources_test.go

Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>

* Update pkg/api/datasources.go

Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>

* review comments

* review during pairing

---------

Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>
2023-10-27 12:37:37 +01:00
Karl Persson
1b6d39f823
IDForwarding: Require that id forwarding is enabled for data source (#77131)
* Require that id forwarding is enabled for data source

* Address feedback
2023-10-27 08:30:33 +02:00
João Calisto
7869ca1932
Feature Management: UI improvements (#76866)
* Feature Management: UI improvements

* update UI logic

---------

Co-authored-by: Michael Mandrus <michael.mandrus@grafana.com>
2023-10-26 10:42:00 +01:00
Ieva
39a30b0c01
Bug fix: add library panel permissions to basic roles (#77144)
set library panel permissions to basic roles
2023-10-25 18:44:55 +01:00
Alexander Zobnin
cad3c43bb1
Team LBAC: Move middleware to enterprise (#76969)
* Team LBAC: Move middleware to enterprise

* Remove ds proxy part

* Move utils to enterprise
2023-10-24 14:06:18 +03:00
Sofia Papagiannaki
03a626f1d6
Search: Fix empty folder details for nested folder items (#76504)
* Introduce dashboard.folder_uid column

* Add data migration

* Search: Fix empty folder details for nested folders

* Set `dashboard.folder_uid` and update tests

* Add unique index

* lint

Ignore cyclomatic complexity of func
`(*DashboardServiceImpl).BuildSaveDashboardCommand

* Fix search by folder UID
2023-10-24 10:04:45 +03:00
William Assis
65a7bddcee
Analytics: Add option to pass destSDKBaseURL to rudderstack load method (#74926)
* Add option to pass destSDKBaseURL to rudderstack load method

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

---------

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2023-10-23 12:43:33 +00:00
Ieva
5c4cece430
Fix: align access to the team page with access to the team tab (#76868)
align access to the team page with access to the team tab in the navigation bar
2023-10-20 13:51:03 +01:00
Ieva
94fec65192
RBAC: introduce a data source admin role (#75915)
* introduce data source admin role and fix frontend check

* introduce fixed roles for data source creator and team reader

* add documentation

* undo an unintended change
2023-10-19 14:36:41 +01:00
Joan López de la Franca Beltran
584381e838
Swagger: Type postDashboardResponse.id as int instead of string (#76749)
* Swagger: Type postDashboardResponse.id as int instead of string

* Swagger: Type postDashboardResponse.id as int64
2023-10-19 09:16:53 +02:00
Eric Leijonmarck
17fe1d3fc7
Team LBAC: Refactor to use only the teamHeader json part (#76756)
* refactor: to check for feature toggle and for checking for jsonData field

* fix tests

* whitelisting of X-Prom-Label-Policy Header
2023-10-18 16:09:22 +01:00
Eric Leijonmarck
be5ba68132
Team LBAC: Add teamHeaders for datasource proxy requests (#76339)
* Add teamHeaders for datasource proxy requests

* adds validation for the teamHeaders

* added tests for applying teamHeaders

* remove previous implementation

* validation for header values being set to authproxy

* removed unnecessary checks

* newline

* Add middleware for injecting headers on the data source backend

* renamed feature toggle

* Get user teams from context

* Fix feature toggle name

* added test for validation of the auth headers and fixed evaluation to cover headers

* renaming of teamHeaders to teamHTTPHeaders

* use of header set for non-existing header and add for existing headers

* moves types into datasources

* fixed unchecked errors

* Refactor

* Add tests for data model

* Update pkg/api/datasources.go

Co-authored-by: Victor Cinaglia <victor@grafana.com>

* Update pkg/api/datasources.go

Co-authored-by: Victor Cinaglia <victor@grafana.com>

---------

Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>
Co-authored-by: Victor Cinaglia <victor@grafana.com>
2023-10-17 11:23:54 +01:00
Andres Martinez Gotor
1dd97301e5
Chore: Adapt GetDataSourcesByType to plugins with aliases (#76637) 2023-10-17 11:09:56 +02:00
Jo
48ef88aed7
Access: Fetch fresh permissions for target GlobalOrgID in AuthorizeInOrgMiddleware (#76569)
fetch fresh permissions for global in AuthorizeInOrgMiddleware

Update pkg/services/accesscontrol/authorize_in_org_test.go

do not load viewer permissions in global ID
2023-10-13 21:01:47 +03:00
Juan Cabanas
cdca1518d2
PublicDashboards: Title logo and footer redesign (#74769)
---------

Co-authored-by: Agnès Toulet <35176601+AgnesToulet@users.noreply.github.com>
2023-10-13 13:18:05 -03:00
João Calisto
9fc0e1566e
Feature Management: Update admin page UI after a successful update (#76380)
* Feature Management: Update admin page UI after a successful update

* lint

* lint

* refactor
2023-10-13 11:54:34 +01:00
Gabriel MABILLE
420fb56fda
RBAC: Fix plugins pages access-control (#76321)
* RBAC: Fix plugins pages access-control

* Better comment

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* Add a small comment on connections/datasources routes

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-10-12 10:46:43 +02:00
Jo
466f8a1f5a
Teams: Move team API to own service (#76347)
* move team API to its own service

* remove uneeded import

* reshare pref api logic
2023-10-12 10:10:54 +02:00
kay delaney
a12cb8cbf3
LibraryPanels: Add RBAC support (#73475) 2023-10-12 00:30:50 +01:00
Ashley Harrison
effd2a1189
Navigation: Split admin into subsections behind navAdminSubsections feature toggle (#76280)
* split admin into subsections behind feature toggle

* make authentication a section header

* add translations for subsections

* rename translation keys

* add subtitles
2023-10-11 14:37:36 +01:00
Karl Persson
1528d6f5c4
Authn: Prevent empty username and email during sync (#76330)
* Move errors to error file

* Move check for both empty username and email to user service

* Move check for empty email and username to user service Update

* Wrap inner error

* Set username in test
2023-10-11 14:27:43 +02:00
Sofia Papagiannaki
99e4894636
Chore: Replace mock guardian with the actual one in folder API benchmarks (#76231)
Benchmarks: Replace mock guardian with the actual one
2023-10-10 13:31:55 +03:00
Marcus Efraimsson
90631360eb
Instrumentation: Handle context.Canceled (#75867)
Ref #68480

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
2023-10-10 12:28:39 +02:00
Jo
8919cafcb4
Identity: Unfurl UserID and Email in pkg/api to user identity.Requester (#76112)
* Unfurl OrgRole in pkg/api to allow using identity.Requester interface

* Unfurl Email in pkg/api to allow using identity.Requester interface

* Update UserID in pkg/api to allow using identity.Requester interface

* fix authed test

* fix datasource tests

* guard login

* fix preferences anon testing

* fix anonymous index rendering

* do not error with user id 0
2023-10-09 16:07:28 +02:00
Giuseppe Guerra
cfcfbe4aaa
Plugins: Refactoring: Implement plugin instrumentation as a middleware (#76011)
* Plugins: Refactor instrumentation as plugin client middleware

* Simplify repeated code

* Fix compilation error

* Add comments

* Moved status and endpoint consts to utils.go

* Fix wrong endpoint name in CheckHealth InstrumentationMiddleware

* Add tests

* Fix wrong endpoint value in instrumentPluginRequestSize

* removed todo

* PR review feedback: use MustRegister

* PR review feedback: move tracing middleware before instrumentation middleware

* PR review feedback: removed decommissioned check

* PR review feedback: extract prometheus metrics into separate variables
2023-10-09 14:12:57 +02:00
Jo
41bcb5e07f
Identity: Port folder library to identity.Requester (#76105)
Port folders to identity.Requester
2023-10-06 15:02:34 +02:00
Jo
342af2d078
Identity: Port Annotations and Analytics to Identity.Requester (#76104)
* Port analytics to requester

* Port annotations to identity.Request
2023-10-06 11:38:20 +02:00
Jo
729dafaff9
Auth: Unfurl OrgID in pkg/api to allow using identity.Requester interface (#76108)
Unfurl OrgID in pkg/api to allow using identity.Requester interface
2023-10-06 11:34:36 +02:00
Marcus Efraimsson
e4c1a7a141
Tracing: Standardize on otel tracing (#75528) 2023-10-03 14:54:20 +02:00
Karl Persson
684d68365e
IDforwarding: forward signed id to plugins (#75651)
* Plugins: Add client middlware that forwards the signed grafana id token if present

* DsProxy: Set grafana id header if id token exists

* Add util function to apply id token to header

* Only add id forwarding middleware if feature toggle is enabled

* Add feature toggles to ds proxy and check if id forwarding is enabled

* Clean up test setup

* Change to use backend.ForwardHTTPHeaders interface

* PluginProxy: Forward signed identity when feature toggle is enabled

* PluginProxy: forrward signed id header
2023-10-02 09:14:10 +02:00
Ryan McKinley
010b2461b9
Plugins: Move alias support to plugin json (but still hardcoded) (#75129) 2023-09-29 08:20:37 -07:00
Karl Persson
7a38090bc0
AuthN: Fix namespaces for anonymous and render (#75661)
* AuthN: remove IsAnonymous from identity struct and set correct namespace for anonymous and render

* Don't parse user id for render namespace
2023-09-29 09:10:33 +02:00
Gabriel MABILLE
6ffd4a23de
Team: Support sort query param for teams search endpoint (#75622)
* Teams: Implement backend sorting

* Add docs

* Make name ordering case insensitive

* lint

* Fix no lowercasing on memberCount

* Add test to double check the filters or correctly OrderBy
2023-09-28 18:20:51 +03:00
Sergey Kostrukov
3ee40d3a5a
Azure: Settings for Azure AD Workload Identity (#75283)
* Settings for Azure AD Workload Identity

* Update dependency on Grafana Azure SDK

* Documentation

* Fix JS code

* Cleanup Prometheus backend code

* Making prettier happy
2023-09-28 12:05:16 +01:00
Gabriel MABILLE
96cbe70b14
User: Support sort query param for user and org user, search endpoints (#75229)
* User: Add sort option to user search

* Switch to an approach that uses the dashboard search options

* Cable user sort on the org endpoint

* Alias user table with u in org store

* Add test and cover orgs/:orgID/users/search endpoint

* Add test to userimpl store

* Simplify the store_test with sortopts.ParseSortQueryParam

* Account for PR feedback

* Positive check

* Update docs

* Update docs

* Switch to ErrOrFallback

Co-authored-by: Karl Persson <kalle.persson@grafana.com>

---------

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2023-09-28 10:16:18 +02:00
Ryan McKinley
bbdd1fc3b1
Playlist: Remove unused/deprecated api and unused wrapper (#75503) 2023-09-27 15:28:16 +00:00
Marcus Efraimsson
0128d0403f
Tracing: Use tracing.InitializeTracerForTest (#75479) 2023-09-27 09:51:57 +02:00
Carl Bergquist
8d62ed77f0
instrumentation: set slogroup high-fast for more handlers (#75449)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2023-09-26 19:11:29 +02:00
Marcus Efraimsson
534e3ebf0c
Plugins: Use a Grafana specific SDK tracer implementation for core plugins (#75388) 2023-09-26 14:46:31 +02:00
Kat Yang
9532ff3799
Chore: Split OSS and Enterprise OAPI Spec Generation (#75133)
* chore: implement sofia makefile changes from #62456

* chore: clean up makefile and generate specs

* docs: update command to delete old specs

* fix: regenerate specs with enterprise linked

* chore: implement review comments

* Update Makefile

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

* chore: update make command in drone step

* chore: update bingo, fix makefile indentation error, regen specs

* fix: revert .bingo/README changes to make prettier happy

* chore: add BEP as owners of api-enterprise-spec.json

* chore: rerun drone

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-09-25 15:34:57 -04:00
João Calisto
7e1b45ba31
Feature Toggles API: Trigger webhook call when updating (#75254)
* Feature Toggles API: Trigger webhook call when updating

* update status code error check

* lint - handle Close() error

* Rename update webhook config

* fix tests
2023-09-25 19:11:24 +01:00
Andres Martinez Gotor
ece94b1e01
Chore: Remove plugincontext.ErrPluginNotFound (#74997) 2023-09-25 13:10:47 +03:00
Andres Martinez Gotor
1714fa598c
Chore: Refactor backend plugin errors (#74928) 2023-09-25 11:56:03 +02:00
Andres Martinez Gotor
c70623fb85
Chore: Rename testdata plugin with a fully qualified name (#75104) 2023-09-22 15:00:40 +03:00
Ezequiel Victorero
4cfc834c08
HealthCheck: show enterprise commit (#75242) 2023-09-22 08:17:10 -03:00
Carl Bergquist
e5fbc4a4cd
web: add slo group to request meta (#74765)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2023-09-22 11:52:28 +03:00
Will Browne
7fca1bde54
Plugins: Set grafana config, plugin version and user agent on plugin requests (#75171)
* first pass

* fixup

* remove test line

* fix tests

* use new fields

* fix imports + formatting

* fix tests

* rollback changes

* undo whitespace

* apply pr feedback
2023-09-21 11:33:31 +02:00
Carl Bergquist
764478b9e7
Instrumentation: Set auth as owners for more routes (#75105)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2023-09-20 10:18:52 +02:00
Will Browne
e855efb13d
Plugins: Move store and plugin dto to pluginsintegration (#74655)
move store and plugin dto
2023-09-11 13:59:24 +02:00
Marcus Efraimsson
8ee43f3705
Instrumentation: Add status_source label to request metrics/logs (#74114)
Ref #68480

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
2023-09-11 12:13:13 +02:00
Sofia Papagiannaki
9fcee9b206
Nested folders: Fix folder hierarchy in folder responses (#74516)
Nested folders: Fix hierarchy in folder response
2023-09-08 10:43:41 +03:00
Ashley Harrison
a7425f875e
Browse Dashboards: Update docs to remove reference to General folder (#74528)
* update documentation to remove mention of General folder

* update swagger-tags
2023-09-08 03:57:16 +01:00
Kristin Laemmert
6ce4af7840
chore: remove unused feature flag (#74460)
This commit removes the validateDashboardsOnSave feature flag that is currently not in use.
Closes #70022
2023-09-06 11:25:44 -04:00
linoman
0e8f19ca6a
Auth: Reduce restriction with non-user accounts (#74397)
* Reduce restrictions with non-user accounts

* Revert restrictions on anonymous accounts

* Change log level from warning to debug

* Change log messages to upper case
2023-09-06 13:37:54 +02:00
linoman
13f4382214
Auth: Implement requester interface in access control module (#74289)
* Implement requester interface in the access control module
2023-09-06 11:16:10 +02:00
Ieva
58efa49933
Chore: remove IsDisabled method for access control (#74340)
remove IsDisabled method for access control, clean up tests
2023-09-05 11:04:39 +01:00
Ryan McKinley
025b2f3011
Chore: use any rather than interface{} (#74066) 2023-08-30 18:46:47 +03:00
linoman
1b8e9b51b2
Replace signed in user for identity.requester (#74048)
* Make identity.Requester available at Context

* Clean pkg/services/guardian/guardian.go

* Clean guardian provider and guardian AC

* Clean pkg/api/team.go

* Clean ctxhandler, datasources, plugin and live

* Clean dashboards and guardian

* Implement NewUserDisplayDTOFromRequester

* Change status code numbers for http constants

* Upgrade signature of ngalert services

* log parsing errors instead of throwing error
2023-08-30 16:51:18 +02:00
Karl Persson
127473f4a4
API: Remove usage of legacy dashboard guardian in tests (#73937) 2023-08-29 15:09:09 +02:00
Jo
fe1563882a
Chore: Port oauth token service to identity requester (#73988)
* port oauth token service to identity requester

* fix broken test

* no need to check for render
2023-08-29 11:55:58 +02:00
venkatbvc
7c98678188
Auth: Add support for OIDC RP-Initiated Logout (#70357)
* Fix signout redirect_uri issue

* Fix signout redirect_uri issue

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* remove signout url global

* style alignment

* remove legacy handlers for devenv

* Update pkg/api/login.go

---------

Co-authored-by: Rao B V Chalapathi <b_v_chalapathi.rao@nokia.com>
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: jguer <me@jguer.space>
2023-08-29 11:34:11 +02:00
Jo
a307582212
Revert "Replace signed in user for identity.requester (#73750)" (#73962)
This reverts commit 9b9c9e83dc.
2023-08-28 21:05:59 +02:00
linoman
9b9c9e83dc
Replace signed in user for identity.requester (#73750)
* Make identity.Requester available at Context

* Clean pkg/services/guardian/guardian.go

* Clean guardian provider and guardian AC

* Clean pkg/api/team.go

* Clean ctxhandler, datasources, plugin and live

* Question: what to do with the UserDisplayDTO?

* Clean dashboards and guardian

* Remove identity.Requester from ReqContext

* Implement NewUserDisplayDTOFromRequester

* Fix tests

* Change status code numbers for http constants

* Upgrade signature of ngalert services

* log parsing errors instead of throwing error

* Fix tests and add logs

* linting
2023-08-28 12:04:36 -05:00
Jo
5eed495cce
Chore: Port user services to identity.Requester (#73851)
* port api key api to signedinuser

* port users to signed in user interface

* fix tests
2023-08-28 10:42:24 +02:00
Karl Persson
01d98114b9
Authz: fix snapshot tests legacy guardian (#73823)
* Guardian: remove unused dependencies

* API: rewrite tests to use access control guardian
2023-08-28 09:49:10 +02:00
Torkel Ödegaard
3ee26df41e
PublicDashboards: Variables refactor (#73476)
Co-authored-by: Juan Cabanas <juan.cabanas@grafana.com>
Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-08-25 13:56:02 -05:00
Ieva
ca46a5c1af
Chore: prepare for removing RBACenabled config option (#73845)
prepare for removing RBACenabled config option
2023-08-25 17:13:46 +02:00
Ieva
6885b3d577
Chore: remove checks for whether RBAC is disabled (#73812)
* remove checks for whether access control is disabled, as it is always enabled now

* linting
2023-08-25 14:19:58 +01:00
Serge Zaitsev
00893a158c
Chore: return a JSON on folder DELETE (#73604) 2023-08-24 18:10:58 +02:00
Karl Persson
05c386504b
authz: Clean up acl endpoints and dashboard guardian (#73746)
* RBAC: remove unnessisary guardian construction and update tests

* RBAC: remove usage of guardian in UpdateFolderPermissions and refactor test

* RBAC: remove usage of guardian in update and get permissions for dashboards
2023-08-24 15:37:54 +02:00
Marcus Efraimsson
040b7d2571
Chore: Add errutils helpers (#73577)
Add helpers for the errutil package in favor of errutil.NewBase.
2023-08-22 12:52:24 +02:00
Ieva
ec9c35fae5
Chore: clean up access control for data sources (#73010)
* move DS guardian interfaces to OSS, move allow guardian to OSS

* update codeowner file
2023-08-21 14:26:49 +01:00
Joao Silva
3bb23d6be7
Whitelabeling: Add a config option to hide the Grafana edition from the footer (#73412) 2023-08-18 15:09:36 +01:00
Jo
26339f978b
Auth: Move access control API to SignedInUser interface (#73144)
* move access control api to SignedInUser interface

* remove unused code

* add logic for reading perms from a specific org

* move the specific org logic to org_user.go

* add a comment

---------

Co-authored-by: IevaVasiljeva <ieva.vasiljeva@grafana.com>
2023-08-18 11:42:18 +01:00
Will Browne
3c50db328d
Plugins: Make Installer responsible for removing plugins from file system (#73323)
* installer is responsible for removing from file system

* take plugin as arg

* remove resolve step

* return plugin in test
2023-08-16 15:44:20 +02:00
Carl Bergquist
243b757168
Middleware: Add team metadata to HTTP handlers (#71010)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2023-08-16 15:05:19 +02:00
Karl Persson
43aab615c3
Auth: Remove unused Authenticator service (#73143)
Auth: remove unused Authenticator service
2023-08-10 11:02:32 +02:00
Will Browne
d29f4a8f76
Plugins: Add context to StaticRouteResolver and ErrorResolver interfaces (#73121)
* add ctx

* fix tests
2023-08-10 10:32:12 +02:00
Karl Persson
2c57bca176
Auth: Remove auth broker flag and clean up login handlers (#73109)
* Auth: Remove auth broker flag and clean up login handlers
2023-08-10 09:56:04 +02:00
Will Browne
72da44db0e
Plugins: Add validation stage to plugin loader pipeline (#73053)
* first pass

* change validation signature

* err tracking

* fix

* undo golden

* 1 more

* fix

* adjust doc

* add test helper

* fix linter
2023-08-09 18:25:28 +02:00
Michael Mandrus
779e0fe311
Feature Toggles: Create API for updating feature toggle state from the feature toggle admin page (#73022)
* create roles for writing feature toggles

* create update endpoint / handler

* api changes

* add feature toggle validations

* hide toggles based on their state

* make FlagFeatureToggle read only

* add username log

* add username string

* refactor for better readability

* refactor unit tests so we can do more validations

* some skeletoning for the set tests

* write unit tests for updater

* break helper functions out

* update sample ini to match defaults

* add more logic to ReadOnly label

* add user documentation

* fix lint issue

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: J Stickler <julie.stickler@grafana.com>

* Update docs/sources/setup-grafana/configure-grafana/_index.md

Co-authored-by: J Stickler <julie.stickler@grafana.com>

---------

Co-authored-by: IbrahimCSAE <ibrahim.mdev@gmail.com>
Co-authored-by: J Stickler <julie.stickler@grafana.com>
2023-08-09 11:32:28 -04:00
Karl Persson
e53e22ef2a
Contexthandler: Remove code that is no longer used (#73101)
* Contexthandler: remove dead code

* Contexthandler: Add tests

* Update pkg/tests/api/alerting/api_alertmanager_test.go

Co-authored-by: Jo <joao.guerreiro@grafana.com>

---------

Co-authored-by: Jo <joao.guerreiro@grafana.com>
2023-08-09 15:17:59 +02:00
Jo
5d8e6aa162
Auth: Org Invite and Team API SignedInUser interfacing (#73085)
* fix ngalert Evaluate sig change

* interface for teams and org invites

* Update pkg/api/org_invite.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-08-09 12:33:35 +02:00
Karl Persson
144e4887ee
Auth: Use authn.Service for all tests (#72921)
* Dashboards: Fix tests when authn broker is enabled.
StarService was not configured for tests, the call was guarded by !c.IsSignedIn

* Change default to be anon user to match expectations from tests

* OAuth: rewrite tests to work with authn.Service

* Setup template renderer by default

* Extract cookie options from cfg instead of relying on global variables

* Fix test to work with authn service

* Middleware: rewrite auth tests

* Remvoe session cookie if we cannot refresh access token
2023-08-09 08:54:52 +02:00
Maksym Revutskyi
d9c232b331
Auth: prevent auto_login redirect if user is already authenticated (#72477)
* Auth: prevent auto_login redirect if user is already authenticated

Before attempting an auto-login for OAuth, verifies if current context has already been
authenticated.

Fixes: #72476

Co-authored-by: Karl Persson <kalle.persson92@gmail.com>
2023-08-07 09:14:31 +02:00
Will Browne
98f827537b
Plugins: Add remaining steps to inititialization stage (#72894)
add remainder of init steps
2023-08-04 12:35:57 +02:00
Will Browne
60b4a0b2a4
Plugins: Add termination stage to plugin loader pipeline (#72822)
* add termination stage

* uid -> pluginID (for now)

* also fix fakes

* add simple test

* Fix logger name

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>

* inline stop func call

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>

---------

Co-authored-by: Giuseppe Guerra <giuseppe.guerra@grafana.com>
2023-08-04 11:57:49 +02:00
Josh Hunt
7bc6d32eb9
Search API: Search by folder UID (#65040)
* Search: Attempt to support folderUID filter

* Search: Use folder UID instead of ID for searching folders

* Update swagger

* Fix JSON property casing

* Add integration test

* Remove redundant query condition

* Fix frontend test

* Fix listing dashboards in General/root

* Add support for fetching top level folders

using `folderUIDs=` (empty string) query parameter

* Add deprecation notice

* Send uid of general in sql.ts

* Use 'general' for query folderUIDs query param for fetching folder

* Add tests

* Fix FolderUIDFilter

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-08-04 12:43:47 +03:00