Commit Graph

3305 Commits

Author SHA1 Message Date
Stephanie Hingtgen
255d8f3326
Plugins: Remove secure socks proxy feature toggle (#66611) 2023-04-18 11:11:23 -06:00
Andres Martinez Gotor
98c695c68f
Chore: Use Grafana API to retrieve the public key to validate plugins (#66439) 2023-04-18 16:12:05 +02:00
Eric Leijonmarck
15c9ced944
Revert "APIkeys: Add metrics for apikey endpoints (#66732)" (#66754)
This reverts commit c505d26430.
2023-04-18 13:05:52 +01:00
Eric Leijonmarck
c505d26430
APIkeys: Add metrics for apikey endpoints (#66732)
add metrics for apikey endpoints
2023-04-18 11:12:19 +01:00
Ryan McKinley
39c04a8e36
Chore: Remove deprecated dashboardId from panel query runner (#64786) 2023-04-14 16:50:10 -07:00
Arati R
cab3ba519a
NestedFolders: Add folder service registry with dashboard service implementation (#65033)
* Delete folders, dashboards with registry service
Co-authored-by: Serge Zaitsev <hello@zserge.com>
* Update signature of ProvideDashboardServiceImpl
* Regenerate mockery file
* Add test for DeleteInFolder
* Add test for DeleteDashboardsInFolder
* Delete child dashboard associations via registry
* Add validation of folder uid and org id

---------

Co-authored-by: Serge Zaitsev <hello@zserge.com>
2023-04-14 11:17:23 +02:00
Ashley Harrison
4abe0249ba
Chore: Clean up old navigation (#66287)
* remove code outside of the topnav feature flag

* delete NavBar folder

* remove topnav toggle from backend

* restructure AppChrome folder

* fix utils mock

* fix applinks tests

* remove tests since they're covered in e2e

* fix 1 of the approotpage tests

* Fix another dashboardpage test

* remove reverse portalling + test for plugins using deprecated onNavChanged method

* kick drone

* handle correlations
2023-04-14 09:43:11 +01:00
Artur Wierzbicki
2136e680c4
Previews: remove dashboard previews backend (#66176)
* remove dashboard previews backend

* remove dashboard previews backend

* bring back the migration

* bring back the migration

* bring back the migration
2023-04-13 21:42:24 +04:00
Michael Mandrus
5626461b3c
Caching: Refactor enterprise query caching middleware to a wire service (#65616)
* define initial service and add to wire

* update caching service interface

* add skipQueryCache header handler and update metrics query function to use it

* add caching service as a dependency to query service

* working caching impl

* propagate cache status to frontend in response

* beginning of improvements suggested by Lean - separate caching logic from query logic.

* more changes to simplify query function

* Decided to revert renaming of function

* Remove error status from cache request

* add extra documentation

* Move query caching duration metric to query package

* add a little bit of documentation

* wip: convert resource caching

* Change return type of query service QueryData to a QueryDataResponse with Headers

* update codeowners

* change X-Cache value to const

* use resource caching in endpoint handlers

* write resource headers to response even if it's not a cache hit

* fix panic caused by lack of nil check

* update unit test

* remove NONE header - shouldn't show up in OSS

* Convert everything to use the plugin middleware

* revert a few more things

* clean up unused vars

* start reverting resource caching, start to implement in plugin middleware

* revert more, fix typo

* Update caching interfaces - resource caching now has a separate cache method

* continue wiring up new resource caching conventions - still in progress

* add more safety to implementation

* remove some unused objects

* remove some code that I left in by accident

* add some comments, fix codeowners, fix duplicate registration

* fix source of panic in resource middleware

* Update client decorator test to provide an empty response object

* create tests for caching middleware

* fix unit test

* Update pkg/services/caching/service.go

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>

* improve error message in error log

* quick docs update

* Remove use of mockery. Update return signature to return an explicit hit/miss bool

* create unit test for empty request context

* rename caching metrics to make it clear they pertain to caching

* Update pkg/services/pluginsintegration/clientmiddleware/caching_middleware.go

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* Add clarifying comments to cache skip middleware func

* Add comment pointing to the resource cache update call

* fix unit tests (missing dependency)

* try to fix mystery syntax error

* fix a panic

* Caching: Introduce feature toggle to caching service refactor (#66323)

* introduce new feature toggle

* hide calls to new service behind a feature flag

* remove licensing flag from toggle (misunderstood what it was for)

* fix unit tests

* rerun toggle gen

---------

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2023-04-12 12:30:33 -04:00
Misi
2c21090931
AccessControl: Allow editors to access GET /api/datasources (#66343)
Allow editors to access GET /datasources
2023-04-12 14:53:05 +02:00
Eric Leijonmarck
2031997994
API keys: Add deprecation to api keys (#65948)
* add: deprecation to api keys write path

* boolean w. meessage

* add read and delete endpoints

* better description of deprecation

* updated with puncutations
2023-04-11 15:58:35 +01:00
Will Browne
bff9f4c890
Plugins: Move config factory to pluginsintegration package (#65716)
* move config to pluginsintegration package

* change to all plugin toggle

* fixes

* fixes

* fix lerna

* fix test
2023-04-05 14:40:08 +02:00
Will Browne
819c2f4ad8
Plugins: Remove unnecessary CDN code (#65929)
remove unnecessary code
2023-04-04 17:01:49 +02:00
Karl Persson
46cfb73e21
AuthToken: client token rotation fix (#65709)
* AuthToken: respond with 401 if token is not found

* Set retry to one so we don't retry a failed token rotation
2023-03-31 16:44:08 +02:00
Emil Tullstedt
be9361cb9e
Logger: Add feature toggle for errors in HTTP request logs (#64425) 2023-03-31 15:38:09 +02:00
Giuseppe Guerra
09078b14e1
Plugins: Support for distributed tracing in backend plugins SDK (#63714)
* Tracing: Pass OTLP address and propagation format to plugins

* Fix unit tests

* Fix indentation

* Fix plugin manager integration tests

* Goimports

* Pass plugin version to plugins

* Do not add GF_PLUGIN_VERSION if plugin version is not set, add tests

* Allow disabling plugins distributed tracing on a per-plugin basis

* Moved disabled plugins to tracing.opentelemetry config section

* Pre-allocate DisabledPlugins map to the correct size

* Moved disable tracing setting flags in plugin settings

* Renamed plugin env vars for tracing endpoint and propagation

* Fix plugin initializer tests

* Refactoring: Moved OpentelemetryCfg from pkg/infra to pkg/plugins

* Changed GetSection to Section in parseSettingsOpentelemetry

* Add tests for NewOpentelemetryCfg

* Fix test case names in TestNewOpentelemetryCfg

* OpenTelemetry: Remove redundant error checks
2023-03-30 23:31:14 +02:00
Sofia Papagiannaki
3cd3bb00ec
API: Fix "Updated by" Column in dashboard versions table (#65351)
* API: Fix dashboard versions created by field

* Add tests

* Update OpenAPI specs

* Apply suggestion from code review
2023-03-30 17:31:53 +03:00
Serge Zaitsev
f19569d61d
Chore: Remove result field from search (#65583)
remove result field from search
2023-03-30 11:28:12 +02:00
Sofia Papagiannaki
c65cd5833a
Nested folders: Fix move (#65526)
* Nested Folders: Fix move response

Fix JSON tags to be consistent with the GET endpoint

* Add API test for moving to root folder

* Allow move to root folder

* Fix failure message

* Update OpenAPI specification
2023-03-30 11:46:11 +03:00
Serge Zaitsev
2025c1dac1
Chore: Remove result field from stats (#65166)
remove result field from stats
2023-03-30 08:08:47 +02:00
Will Browne
7bbe255150
Plugins: Add file store abstraction for handling plugin files (#65432)
* add file store

* fix markdown fetch bug

* add markdown tests

* fix var name
2023-03-29 12:55:55 +02:00
Serge Zaitsev
46605a3791
Chore: Fix authinfo api after result field removal (#65487)
fix authinfo api after result field removal
2023-03-28 23:12:57 +03:00
Serge Zaitsev
a38f230d37
Chore: Remove result fields from login (#65136)
* remove result fields from login

* fix tests

* fix tests

* another shadowing
2023-03-28 20:32:21 +02:00
Serge Zaitsev
b2ab57d14b
Chore: Remove result field from notifications (#65170)
* remove result field from notifications

* fix test
2023-03-28 13:44:15 +02:00
Giuseppe Guerra
a89202eab2
Plugins: Improve instrumentation by adding metrics and tracing (#61035)
* WIP: Plugins tracing

* Trace ID middleware

* Add prometheus metrics and tracing to plugins updater

* Add TODOs

* Add instrumented http client

* Add tracing to grafana update checker

* Goimports

* Moved plugins tracing to middleware

* goimports, fix tests

* Removed X-Trace-Id header

* Fix comment in NewTracingHeaderMiddleware

* Add metrics to instrumented http client

* Add instrumented http client options

* Removed unused function

* Switch to contextual logger

* Refactoring, fix tests

* Moved InstrumentedHTTPClient and PrometheusMetrics to their own package

* Tracing middleware: handle errors

* Report span status codes when recording errors

* Add tests for tracing middleware

* Moved fakeSpan and fakeTracer to pkg/infra/tracing

* Add TestHTTPClientTracing

* Lint

* Changes after PR review

* Tests: Made "ended" in FakeSpan private, allow calling End only once

* Testing: panic in FakeSpan if span already ended

* Refactoring: Simplify Grafana updater checks

* Refactoring: Simplify plugins updater error checks and logs

* Fix wrong call to checkForUpdates -> instrumentedCheckForUpdates

* Tests: Fix wrong call to checkForUpdates -> instrumentedCheckForUpdates

* Log update checks duration, use Info log level for check succeeded logs

* Add plugin context span attributes in tracing_middleware

* Refactor prometheus metrics as httpclient middleware

* Fix call to ProvidePluginsService in plugins_test.go

* Propagate context to update checker outgoing http requests

* Plugin client tracing middleware: Removed operation name in status

* Fix tests

* Goimports tracing_middleware.go

* Goimports

* Fix imports

* Changed span name to plugins client middleware

* Add span name assertion in TestTracingMiddleware

* Removed Prometheus metrics middleware from grafana and plugins updatechecker

* Add span attributes for ds name, type, uid, panel and dashboard ids

* Fix http header reading in tracing middlewares

* Use contexthandler.FromContext, add X-Query-Group-Id

* Add test for RunStream

* Fix imports

* Changes from PR review

* TestTracingMiddleware: Changed assert to require for didPanic assertion

* Lint

* Fix imports
2023-03-28 11:01:06 +02:00
Will Browne
1387fec51d
Plugins: Markdown fetch retry with lowercase (#65384)
* retry with lowercase

* undo incorrect err check

* re-add defer to close file

* fix test
2023-03-27 19:44:06 +03:00
Will Browne
31d6416157
Plugins: Migrate licensing and access control to pkg/services/pluginsintegration package (#65258)
* migrate licensing + access control

* update package name
2023-03-27 11:15:37 +02:00
Karl Persson
382b24742a
Auth: Add feature flag to move token rotation to client (#65060)
* FeatureToggle: Add toggle to use a new way of rotating tokens

* API: Add endpoints to perform token rotation, one endpoint for api request and one endpoint for redirectsd

* Auth: Aling not authorized handling between auth middleware and access
control middleware

* API: add utility function to get redirect for login

* API: Handle token rotation redirect for login page

* Frontend: Add job scheduling for token rotation and make call to token rotation as fallback in retry request

* ContextHandler: Prevent in-request rotation if feature flag is enabled and check if token needs to be rotated

* AuthN: Prevent in-request rotation if feature flag is enabled and check if token needs to be rotated

* Cookies: Add option NotHttpOnly

* AuthToken: Add helper function to get next rotation time and another function to check if token need to be rotated

* AuthN: Add function to delete session cookie and set expiry cookie

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-03-23 14:39:04 +01:00
Ryan McKinley
f96637b5fc
Live: Remove (alpha) ability to configure live pipelines (#65138) 2023-03-22 20:09:44 +02:00
Eric Leijonmarck
3cd952b8ba
Auth: Fix orgrole picker disabled if isSynced user (#64033)
* fix: disable orgrolepicker if externaluser is synced

* add disable to role picker

* just took me 2 hours to center the icon

* wip

* fix: check externallySyncedUser for API call

* remove check from store

* add: tests

* refactor authproxy and made tests run

* add: feature toggle

* set feature toggle for tests

* add: IsProviderEnabled

* refactor: featuretoggle name

* IsProviderEnabled tests

* add specific tests for isProviderEnabled

* fix: org_user tests

* add: owner to featuretoggle

* add missing authlabels

* remove fmt

* feature toggle

* change config

* add test for a different authmodule

* test refactor

* gen feature toggle again

* fix basic auth user able to change the org role

* test for basic auth role

* make err.base to error

* lowered lvl of log and input mesg
2023-03-22 17:41:59 +00:00
Joao Silva
14607e78d1
Admin: Change permissions to /admin page so org admins don't get redirected (#65098) 2023-03-22 15:35:17 +01:00
Serge Zaitsev
743d66396a
Chore: Remove result field from API keys commands and queries (#65055)
* Chore: remove result field from api keys

* fix shadowing

* actually shadowing was all right
2023-03-21 13:26:33 +01:00
Ryan McKinley
91a4b8b529
Chore: remove dashboardsFromStorage (#65058) 2023-03-20 18:36:49 +02:00
Artur Wierzbicki
4274b9414f
Chore: remove querylibrary feature toggle (#65021)
* chore: remove querylibrary

* chore: remove querylibrary

* chore: remove querylibrary
2023-03-20 20:00:14 +04:00
Will Browne
ee2dd62a1f
Plugins: Refactor loader + finder to support multiple sourcing methods (#64735)
* it's cdn time

* tidy body closing

* auto signed

* fix close

* update log name

* remove comments
2023-03-20 14:35:49 +01:00
Ieva
7860ca6c3d
RBAC: protect folder creation and moving (#64636)
* protect moving folders to a subfolder and creating folders in a subfolder

* folder update endpoint isn't used for folder parent update

* lint

* move permission check logic to services, fix tests

* linting
2023-03-20 11:04:22 +00:00
Ezequiel Victorero
8f0a9729f0
PublicDashboards: Allow hidden queries execution (#64858) 2023-03-16 15:39:17 -03:00
Jo
6b6cf5f4b7
Cfg: Move ViewersCanEdit into cfg (#64876)
move ViewersCanEdit into cfg
2023-03-16 10:54:01 +01:00
Jo
ccbf200c4a
SupportBundles: Add OAuth bundle collectors (#64810)
* wip

* add oauth support bundles

* add specific configs for generic oauth and azureAD

* add doc entry

* optimize struct packing

* Update pkg/login/social/azuread_oauth.go

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

* nit update

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-03-16 09:46:25 +02:00
Ryan McKinley
d5a9a0cea0
Chore: remove comments feature (#64644) 2023-03-11 04:28:12 -08:00
Ashley Harrison
3336327306
Navigation: Fix Home logo always going to /login (#62658)
* only redirect to /login when anonymous access is disabled

* only search for dashboards when not logged in if anon access is enabled

* fix go logic

* add unit tests
2023-03-09 16:42:45 +00:00
Eric Leijonmarck
17537b033d
API keys: Add last_used_at and docs changes for migration (#64293)
* feat: last_used_at for apikeys

* add: docs and copy changes

* refactor: use br correctly

* remove docs

* removed more docs
2023-03-09 14:16:42 +00:00
owensmallwood
1a5a280c86
Pubdash: Email sharing handle dashboard deleted (#64247)
dashboard service calls pubdash service when dashboard deleted
2023-03-08 14:54:35 -06:00
Ryan McKinley
42e7ec9fe4
Chore: cleanup dashboard service names (#64442) 2023-03-08 14:37:45 -05:00
Misi
6543259a7d
Auth: Add SyncPermissions post auth hook (#64205)
* Add SyncPermissionsFromDB post auth hook

* Delete FromDB prefix

* Align tests

* Fixes

* Change SyncPermissionsHook prio
2023-03-08 13:35:54 +01:00
Sofia Papagiannaki
43095d84e4
Snapshots: Fix deleting snapshot with non existent dashboard ID (#64345)
* Add test for deleting snapshot for non existent dashboard

* Add test for failure to fetch guardian other than ErrDashboardNotFound

* Fix dashboard snapshot delete
2023-03-08 10:12:02 +02:00
Will Browne
94f39e69a3
Plugins: Migrate plugincontext, adapters and pluginsettings to pkg/services/pluginsintegration package (#64154)
* migrate plugincontext, adapter and pluginsettings

* add to CODEOWNERS

* fix imports

* fix CODEOWNERS

* take pluginsettings

* migrate wire stuff
2023-03-07 11:22:30 -05:00
Will Browne
68df83c86d
Plugins: Add Plugin FS abstraction (#63734)
* unexport pluginDir from dto

* first pass

* tidy

* naming + add mutex

* add dupe checking

* fix func typo

* interface + move logic from renderer

* remote finder

* remote signing

* fix tests

* tidy up

* tidy markdown logic

* split changes

* fix tests

* slim interface down

* fix status code

* tidy exec path func

* fixup

* undo changes

* remove unused func

* remove unused func

* fix goimports

* fetch remotely

* simultaneous support

* fix linter

* use var

* add exception for gosec warning

* fixup

* fix tests

* tidy

* rework cfg pattern

* simplify

* PR feedback

* fix dupe field

* remove g304 nolint

* apply PR feedback

* remove unnecessary gosec nolint

* fix finder loop and update comment

* fix map alloc

* fix test

* remove commented code
2023-03-07 16:47:02 +01:00
Karl Persson
872d2d1e1c
AuthN: Login error handling (#64239)
* Social: Fix type so it appears in error responses

* AuthN: construct errutil.Error from social.Error

* login: Check for errutil.Error and use public message

* Login: redirectURLWithErrorCookie for authn errors

Co-authored-by: Jo <joao.guerreiro@grafana.com>
2023-03-07 09:57:25 +01:00
Sofia Papagiannaki
fde96c91c1
Chore: Differentiate the ErrOrgNotFound error messages (#64131)
* Better org not found error messages
2023-03-06 09:57:46 +02:00
Sofia Papagiannaki
e6e8351ee9
Chore: Remove CreateUserForTests() (#64125)
* Chore: Remove CreateUserForTests

* Apply suggestion from code review
2023-03-03 11:01:23 -05:00
Ieva
a52999a886
Access Control: revert to using folder store from the scope resolvers (#64132)
* revert to using folder store from the resolvers

* fixing tests after revert

* api test fixes

---------

Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2023-03-03 10:56:33 -05:00
Ashley Harrison
d61bcdf4ca
Chore: Pass signed user_hash to Intercom via Rudderstack (#63921)
* move analytics identifiers to backend

* implement hash function

* grab secret from env

* expose and retrieve intercom secret from config

* concat email with appUrl to ensure uniqueness

* revert to just using email

* Revert "revert to just using email"

This reverts commit 8f10f9b1bc.

* add docstring
2023-03-03 14:39:53 +00:00
Karl Persson
f258adadbf
AuthN: add utility functions for different type of login responses (#64133)
* AuthN: add utility functions to handle response and redirect after
successful login

* API: Reuse utility functions for logins if authnService flag is enabled
2023-03-03 14:17:09 +01:00
Jack Westbrook
8c8f584b41
Plugins: Extend panel menu with links from plugins (#63089)
* feat(plugins): introduce dashboard panel menu placement for adding menu items

* test: add test for getPanelMenu()

* added an unique identifier for each extension.

* added context to getPluginExtensions.

* wip

* Wip

* wiwip

* Wip

* feat: WWWIIIIPPPP 🧨

* Wip

* Renamed some of the types to align a bit better.

* added limit to how many extensions a plugin can register per placement.

* decreased number of items to 2

* will trim the lenght of titles to max 25 chars.

* wrapping configure function with error handling.

* added error handling for all scenarios.

* moved extension menu items to the bottom of the more sub menu.

* added tests for configuring the title.

* minor refactorings.

* changed so you need to specify the full path in package.json.

* wip

* removed unused type.

* big refactor to make things simpler and to centralize all configure error/validation handling.

* added missing import.

* fixed failing tests.

* fixed tests.

* revert(extensions): remove static extensions config in favour of registering via AppPlugin APIs

* removed the compose that didn't work for some reason.

* added tests just to verify that validation and error handling is tied together in configuration function.

* adding some more values to the context.

* draft validation.

* added missing tests for getPanelMenu.

* added more tests.

* refactor(extensions): move logic for validating extension link config to function

* Fixed ts errors.

* Update packages/grafana-data/src/types/app.ts

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>

* Update packages/grafana-runtime/src/services/pluginExtensions/extensions.test.ts

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>

* refactor(extensions): rename limiter -> pluginPlacementCount

* refactor(getpanelmenu): remove redundant continue statement

---------

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
2023-03-02 15:42:00 +01:00
Kristin Laemmert
bb798e24f3
chore(services): replace dependencies on dashboard store with dashboard service (#63937)
* chore(services): replace dependencies on dashboard store with dashboard service

This continues the backend service/store split by replacing dashboard store dependencies with service dependencies. the folder service remains the single exception for now; otherwise we'd have a dependency cycle between the folder and dashboard services. I have some ideas for that, but I'll take care of all the easy parts first.

While doing this, I identified and removed a number of unused arguments from the following functions:

NewFolderNameScopeResolver
NewFolderIDScopeResolver
NewFolderUIDScopeResolver
NewDashboardIDScopeResolver
NewDashboardUIDScopeResolver
resolveDashboardScope

I have a small enterprise PR to support this commit.

* lingering fmt
2023-03-02 08:09:57 -05:00
Torkel Ödegaard
27070c252d
ErrorHandling: Fixes issues with bad error messages (#63775) 2023-03-02 13:09:58 +01:00
Kristin Laemmert
157c270ad3
chore: remove export service POC from main (#63945)
* chore: remove export service POC from main

This is a POC and we'll see it, or something like it, again!

* remove frontend changes

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-03-01 12:42:53 -05:00
Sofia Papagiannaki
8aae7be4e5
API: Enable serving Swagger UI by default and add docs and guidelines (#63489)
* Enable serving Swagger UI by default

It used to be served behind the `swaggerUi` feature toggle.

* Remove `swaggerUi` feature toggle

* Add docs and guidelines for updating swagger

* Apply suggestions from code review

Co-authored-by: Josh Hunt <joshhunt@users.noreply.github.com>
2023-03-01 16:36:37 +02:00
Joey
fbd049a094
Profiling: Enable flame graph & Phlare/Parca data sources for all users (#63488)
* Remove flame graph toggle

* Remove beta badge from panel

* Update expectedListResp.json

* Update flame graph container to only show if there is data
2023-03-01 11:32:39 +00:00
Will Browne
ab8de1a0e3
Plugins: Add simple plugin sources service (#63814)
add simple plugin sources svc
2023-02-28 15:27:11 +01:00
zhichli
3c218d742f
Datasources: Add user_agent header customization for outgoing HTTP requests (#63769) 2023-02-28 14:10:05 +01:00
Will Browne
32aa0ad272
Plugins: Remove stream handler from plugins DTO (#63812)
remove stream handler from DTO
2023-02-27 19:48:18 +01:00
Karl Persson
8484d0c4ef
Settings: Remove global variables for auth settings (#63795)
* Setting: Remove global DisableLoginForm and add it to cfg

* Setting: Remove unused BasicAuthEnabled global

* Setting: Remove global OAuthAutoLogin and use from cfg

* Setting: Remove global AnonymousEnabled

* Setting: Remove global values for AuthProxy settings
2023-02-27 15:28:49 +01:00
Jo
3b22955ebb
Orgs: Remove auto assign globals (#63754)
* remove auto assign globals

* add missing gitignore entries
2023-02-27 10:23:38 +01:00
Jo
c8db771939
Users: Fix org user always getting org id = 1 on auto assign false (#63708)
* fix org user always getting org id = 1 on auto assign false

* make tests explicit

* use correct cfg in service accounts

* fix api tests

* fix database test of ac

* fix InsertOrgUser returning affected rows as orgID
2023-02-24 18:08:44 +01:00
Giuseppe Guerra
966bcd3545
Plugins: Fix plugins CDN not working when plugins are not in domain's root path (#63202)
* Plugins CDN: Add support for different CDN root path

* Plugins CDN: Make frontendsettings return the correct CDN base path

* Update comments

* Fix version detection

* Undo frontend changes

* Fix system.js asset path construction

* fix(plugins): translate all plugin css asset paths loaded via cdn

* refactor(plugins): rename extractPluginNameVersionFromUrl and add comments

* Fix typo in comment

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>

* Hardcode CDN URL structure

/{id}/{version}/public/plugins/{id}/{assetPath} is not required anymore in the cdn url template config

---------

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2023-02-24 14:28:13 +01:00
Will Browne
200d2ad249
Plugins: Invalidate plugin context app settings cache post update (#63279)
invalid plugin settings
2023-02-24 12:13:22 +01:00
Emil Tullstedt
3abaf32cf2
Chore: Upgrade golangci-lint to v1.51.2 (#63630)
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-02-23 15:10:03 +01:00
Jo
ff78103a24
Authn: Anon session service (#63052)
* add anon sessions package

* add usage stat fn

* implement count for cache

* add anonservice to authn broker

* lint

* add tests for remote cache count

* move anon service to services

* wrap tagging in goroutine

* make func used
2023-02-21 16:21:18 +01:00
Selene
7ace44c8b5
Chore: Update oapi-codegen library (#62962)
* Update oapi library and thema

* Use fork commit to fix elasticsearch and cloudwatch generators

* Update thema

* Fixes

* Update thema with last fixes

* Sync

* Fix test

* Update thema and schemas

* Update thema
2023-02-21 12:34:24 +01:00
Emil Tullstedt
0caacb3333
Cookies: Provide a mechanism for per user control over cookies (#61566) 2023-02-21 11:19:07 +01:00
Karl Persson
5eaaf9b9b7
RBAC: Rewrite search and plugin list rbac test (#63483)
* API: rewrite rbac tests for search

* API: rewrite rbac tests for listing plugins

* API: remove unused rbac test setup code
2023-02-21 11:13:35 +01:00
Jo
d4cfbd9fd3
LDAP: Move LDAP globals to Config (#63255)
* structure dtos and private methods

* add basic LDAP service

* use LDAP service in ldap debug API

* lower non fatal error

* remove unused globals

* wip

* remove final globals

* fix tests to use cfg enabled

* restructure errors

* remove logger from globals

* use ldap service in authn

* use ldap service in context handler

* fix failed tests

* fix ldap middleware provides

* fix provides in auth_test.go
2023-02-10 19:01:55 +01:00
Jo
c70571c536
SupportBundles: Replace feature toggle with enabled (#63241)
replace feature toggle with enabled
2023-02-10 10:12:04 +01:00
Ryan McKinley
0018c8e9c1
K8S: cleanup and consolidate feature toggles (#63212) 2023-02-09 09:54:00 -08:00
suntala
49b3027049
Chore: Remove Result field from datasources (#63048)
* Remove Result field from AddDataSourceCommand
* Remove DatasourcesPermissionFilterQuery Result
* Remove GetDataSourceQuery Result
* Remove GetDataSourcesByTypeQuery Result
* Remove GetDataSourcesQuery Result
* Remove GetDefaultDataSourceQuery Result
* Remove UpdateDataSourceCommand Result
2023-02-09 15:49:44 +01:00
Ryan McKinley
804bd08f11
Chore: remove unused feature flag showFeatureFlagsInUI (#62908) 2023-02-08 19:01:34 -05:00
Eric Leijonmarck
91b5337600
Auth: Refactoring of frontend skipOrgRoleSync logic to backend (#62921)
* WIP

* refactor: add function in login for externSynced

* refactor: make function to make ExternalSyncedInfo

- adds tests
- refactors strings into consts

* remove: console.log

* remove: unnessecary comment

* added exhaustive tests

* refactor: labelname

* removed unused code

* missspelling

* refactor: based on review comments

* add: comment to functions about authinfo behavior

* Update pkg/services/login/authinfo.go

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

* Update pkg/services/login/authinfo.go

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

* fix: tests

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-02-08 20:11:46 +00:00
Marcus Andersson
ace4175e26
Plugin: Skip preloading disabled app plugins (#63083)
will not preload app plugins that is disabled.
2023-02-08 14:41:49 +01:00
Marcus Andersson
f46f8bdd3a
Plugins: Renamed parts of the UI extension APIs (#63070)
* Renamed target -> id and href -> path after feedback.

* fixed type issues in test page.

* chore(pluginschemajson): update extensions props target -> id

* this is the final.

* fixed typings...again...

---------

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2023-02-08 05:33:28 -05:00
Jo
6322fce725
LDAP: Move to single package cluster (#63035)
* move multildap to ldap package

* move LDAP api and tests to ldap package

* register background service

* lint
2023-02-08 09:32:59 +01:00
Kristin Laemmert
42be0e106f
fix(dashboard version service): add DashboardUID to query and responses (#60800)
* fix(dashboard version service): add DashboardUID to query and responses

The DashboardUID was not populated in the response from Get and ListDashboardVersions. This adds the DashboardUID to the Get query (it was already in List) and populated the DashboardUID in the returned DashboardVersionDTOs.
2023-02-07 12:27:38 -05:00
Marcus Andersson
1cfd3f81fb
Plugins: Support for link extensions (#61663)
* added extensions to plugin.json and exposing it via frontend settings.

* added extensions to the plugin.json schema.

* changing the extensions in frontend settings to a map instead of an array.

* wip

* feat(pluginregistry): begin wiring up registry

* feat(pluginextensions): prevent duplicate links and clean up

* added test case for link extensions.

* added tests and implemented the getPluginLink function.

* wip

* feat(pluginextensions): expose plugin extension registry

* fix(pluginextensions): appease the typescript gods post rename

* renamed file and will throw error if trying to call setExtensionsRegistry if trying to call it twice.

* added reafactorings.

* fixed failing test.

* minor refactorings to make sure we only include extensions if the app is enabled.

* fixed some nits.

* Update public/app/features/plugins/extensions/registry.test.ts

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>

* Update packages/grafana-runtime/src/services/pluginExtensions/registry.ts

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>

* Update packages/grafana-runtime/src/services/pluginExtensions/registry.ts

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>

* Update public/app/features/plugins/extensions/registry.test.ts

Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>

* Moved types for extensions from data to runtime.

* added a small example on how you could consume link extensions.

* renamed after feedback from levi.

* updated the plugindef.cue.

* using the generated plugin def.

* added tests for apps and extensions.

* fixed linting issues.

* wip

* wip

* wip

* wip

* test(extensions): fix up failing tests

* feat(extensions): freeze registry extension arrays, include type in registry items

* added restrictions in the pugindef cue schema.

* wip

* added required fields.

* added key to uniquely identify each item.

* test(pluginextensions): align tests with implementation

* chore(schema): refresh reference.md

---------

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
2023-02-07 17:20:05 +01:00
Ryan McKinley
b1e58eb47e
Chore: Replace short UID generation with more standard UUIDs (#62731) 2023-02-06 20:44:37 -05:00
Jo
f9163351fd
Support bundles: Refactor registry into separate service (#62945)
* add bundle registry service to avoid dependency cycles

* move user support bundle collector to user service

* move usage stat bundle implementation to usage stats

* add info for background service

* fix remaining imports

* whitespace
2023-02-06 17:50:03 +01:00
Jo
14a78b58e9
Authn: Stat registration (#62934)
* reorganize auth usage stats

* usage stat privilege elevators

* stat count of modified role

* cfg related info

* add authn anon client

* kv store

* ensure anon enabled is collected even if client is not registered

* fix usage stats test
2023-02-06 17:23:53 +01:00
Ryan McKinley
39116b9c11
Chore: Remove previews crawler UI (and feature flag) (#62906) 2023-02-03 16:45:10 -05:00
idafurjes
982939111b
Rename Id to ID for annotation models (#62886)
* Rename Id to ID for annotation models

* Add xorm tags

* Rename Id to ID for API key models

* Add xorm tags
2023-02-03 17:23:09 +01:00
idafurjes
00d954320f
Chore: rename Id to ID in alert notification models (#62868) 2023-02-03 15:46:55 +01:00
Jo
12d192d80e
AccessControl: Clear user permission cache for update org user role (#62745)
* clear user permission cache for update org user role

* check enabled state of ac
2023-02-03 08:37:41 -05:00
Michael Mandrus
7391793504
Query Caching: Add per-panel query caching TTL (#61968)
* *Create Caching Config interface and OSS impl
*Create front-end facing DS Cache config
*Populate Caching Config on Datasource DTO
*Update OSS wire deps

* fix unit test

* handle query caching TTL override on the frontend

* Make sure the override works with pubdash

* move caching config to the right place in the ds info

* move caching config logic to enterprise index hook

* move queryCachingTTL to pubdash query payload

* Remove  from metadata (not needed)

* rename struct and add comment

* remove invalid wire dependency

* manual revert of 395c74b

* fix frontend test

* fix backend test

* fix tests for real this time

* truly fix frontend test

* fix back end unit test for real
2023-02-02 23:39:54 -05:00
idafurjes
23c27cffb3
Chore: Rename Id to ID in alerting models (#62777)
* Chore: Rename Id to ID in alerting models

* Add xorm tags for datasource

* Add xorm tag for uid
2023-02-02 17:22:43 +01:00
Andres Martinez Gotor
68862ce3e8
Plugins: Prefer to use the data source UID when querying (#62776) 2023-02-02 15:43:07 +01:00
Karl Persson
1204d607a5
RBAC: Rewrite org users rbac tests (#62469)
* API: refactor legacy org users access control tests
2023-02-02 15:33:25 +01:00
Serge Zaitsev
b1c98f7119
Chore: Remove result field from alert commands and queries (#62714)
* remove result field from alert notification commands and queries

* fix a few more tests

* ok, linter

* remove alert result fields

* fix api calls

* et tu, linter
2023-02-02 09:41:05 +01:00
idafurjes
2c50c44d89
Chore: Move library elements models to library elements service (#62507)
* Chore: Move library elements models to library elements service

* Fix stat import

* Fix faulty error assignment
2023-02-01 17:32:05 +01:00
Eric Leijonmarck
8ff19bd901
Auth: Add Generic oauth skip org role sync setting (#62418)
* add: generic oauth skip org role sync

* add: docs

* add: backend login skip sync

* fix: docs typo

* add: tests

* remove public key

* fix markdown for generic oauth

* add: generic oauth to the configuration

* refactor: change debug to warn
2023-02-01 16:27:53 +00:00
Will Browne
317f044e70
Plugins: Ensure proxy route bodies are valid JSON (#61771)
ensure proxy route bodies are valid JSON
2023-02-01 16:37:08 +01:00
Sofia Papagiannaki
f143b0a5b2
Chore: Move folder store interface, implementation and test under pkg/services/folder (#62586)
* Chore: Move folder store into folder service package

* Split folder and dashboard store implementations
2023-02-01 15:43:21 +02:00
Josh Hunt
138575cbe9
Config: Refactor frontend settings to struct (#61990)
* Config: Make frontend settings a struct rather than map

remove frontend settings to setting package

remove frontend settings struct to dtos package

rearrange structs to avoid cycles

rename getFrontendSettings fn

omitempty

fix login test

fix middleware test

* wip some enterprise types

* cleanup, moved structs from enterprise

* ci
2023-01-31 19:14:15 +00:00
Jo
99155c75e6
SupportBundles: Add URL in troubleshoot panels to support bundles (#62477)
* add link

* add link

* update text

* update access

---------

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2023-01-31 16:12:20 +01:00
Ieva
a46d62cf48
RBAC: only set basic role permissions for folders without parents (#62486)
only set basic role permissions for folders without parents
2023-01-31 12:13:26 +00:00
idafurjes
cbc10f9c5d
Chore: Delete password and search from models package (#62482)
* Chore: Delete password and search from models package

* Rename model to AdminCreateUserResponse
2023-01-31 11:04:55 +01:00
Ieva
ee3d742c7d
RBAC: inherit folder permissions when resolving managed permissions (#62244)
* add nested folder scope inheritance to managed permission services

* add a more specific erorr

* remove circular dependencies

* use errutil for returning erorr

* fix tests

* fix tests

* define a new error in ac package
2023-01-30 14:19:42 +00:00
idafurjes
3bda112c5f
Chore: Move search model from models package to search service (#62215)
* Chore: Move search model from models package to search service

* Remove unused imports

* Cleanup after merge
2023-01-30 15:17:53 +01:00
Karl Persson
efeb0daec6
AuthN: Add oauth clients and perform oauth authentication with authn.Service (#62072)
* AuthN: Update signature of redirect client and RedirectURL function

* OAuth: use authn.Service to perform oauth authentication and login if feature toggle is enabled

* AuthN: register oauth clients

* AuthN: set auth module metadata

* AuthN: add logs for failed login attempts

* AuthN: Don't use enable disabled setting

* OAuth: only run hooks when authnService feature toggle is disabled

* OAuth: Add function to handle oauth errors from authn.Service
2023-01-30 12:45:04 +01:00
Eric Leijonmarck
a232e7ceca
Auth: Add skip_org_role_sync for Okta (#62106)
* WIP

* Update pkg/services/login/authinfo.go

* fix: merge

* change order to internal last

* adds: docs

* add: configuration for defaults and sample

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

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

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

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

---------

Co-authored-by: Jo <joao.guerreiro@grafana.com>
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2023-01-30 10:54:14 +00:00
Josh Hunt
d51e7ec7ef
Preferences: Add theme preference to match system theme (#61986)
* user essentials mob! 🔱

lastFile:pkg/api/preferences.go

* user essentials mob! 🔱

* user essentials mob! 🔱

lastFile:packages/grafana-data/src/types/config.ts

* user essentials mob! 🔱

lastFile:public/app/core/services/echo/utils.test.ts

* user essentials mob! 🔱

* user essentials mob! 🔱

lastFile:public/views/index-template.html

* user essentials mob! 🔱

* Restore currentUser.lightTheme for backwards compat

* fix types

* Apply suggestions from code review

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

* cleanup

* cleanup

---------

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2023-01-30 10:51:51 +01:00
Serge Zaitsev
324310abbc
Chore: Fix goimports grouping in pkg/api (#62419)
* fix goimports

* fix goimports order
2023-01-30 08:18:26 +00:00
Kristin Laemmert
9256a520a4
chore: move user_auth models to (mostly) login service (#62269)
* chore: move user_auth models to (mostly) login service
2023-01-27 13:36:54 -05:00
Matthew Jacobson
c006df375a
Alerting: Create endpoints for exporting in provisioning file format (#58623)
This adds provisioning endpoints for downloading alert rules and alert rule groups in a 
format that is compatible with file provisioning. Each endpoint supports both json and 
yaml response types via Accept header as well as a query parameter 
download=true/false that will set Content-Disposition to recommend initiating a download 
or inline display.

This also makes some package changes to keep structs with potential to drift closer 
together. Eventually, other alerting file structs should also move into this new file 
package, but the rest require some refactoring that is out of scope for this PR.
2023-01-27 11:39:16 -05:00
Giuseppe Guerra
af1e2d68da
Plugins: Allow loading panel plugins from a CDN (#59096)
* POC: Plugins CDN reverse proxy

* CDN proxy POC: changed env var names

* Add authorization: false for /public path in frontend plugin loader

* Moved CDN settings to Cfg, add some comments

* Fix error 500 in asset fetch if plugin is not using CDN

* Fix EnterpriseLicensePath declared twice

* Fix linter complaining about whitespaces

* Plugins CDN: Skip signature verification for CDN plugins

* Plugins CDN: Skip manifest and signature check for cdn plugins

* Plugins: use IsValid() and IsInternal() rather than equality checks

* Plugins CDN: remove comment

* Plugins CDN: Fix seeker can't seek when serving plugins from local fs

* Plugins CDN: add back error codes in getLocalPluginAssets

* Plugins CDN: call asset.Close() rather than asset.readSeekCloser.Close()

* Plugins CDN: Fix panic in JsonApiErr when errorMessageCoder wraps a nil error

* Plugins CDN: Add error handling to proxyCDNPluginAsset

* Plugins CDN: replace errorMessageCoder with errutil

* Plugins CDN POC: expose cdn plugin paths to frontend for system.js

* Plugins CDN: Fix cdn plugins showing as unsigned in frontend

* WIP: Add support for formatted URL

* Fix missing cdnPluginsBaseURLs in GrafanaConfig

* Plugins CDN: Remove reverse proxy mode and reverse proxy references

* Plugins CDN: Simplify asset serving logic

* Plugins CDN: sanitize redirect path

* Plugins CDN: Removed unused pluginAsset type

* Plugins CDN: Removed system.js changes

* Plugins CDN: Return different system.js baseURL and module for cdn plugins

* Plugins CDN: Ensure CDN is disabled for non-external plugins

* lint

* Plugins CDN: serve images and screenshots from CDN, refactoring

* Lint

* Plugins CDN: Fix URLs for system.js (baseUrl and module)

* Plugins CDN: Add more tests for RelativeURLForSystemJS

* Plugins CDN: Iterate only on apps when preloading

* Plugins CDN: Refactoring

* Plugins CDN: Add comments to url_constructor.go

* Plugins CDN: Update defaultHGPluginsCDNBaseURL

* Plugins CDN: undo extract meta from system js config

* refactor(plugins): migrate systemjs css plugin to typescript

* feat(plugins): introduce systemjs cdn loader plugin

* feat(plugins): add systemjs load type

* Plugins CDN: Removed RelativeURLForSystemJS

* Plugins CDN: Log backend redirect hits along with plugin info

* Plugins CDN: Add pluginsCDNBasePath to getFrontendSettingsMap

* feat(plugins): introduce cdn loading for angular plugins

* refactor(plugins): move systemjs cache buster into systemjsplugins directory

* Plugins CDN: Rename pluginsCDNBasePath to pluginsCDNBaseURL

* refactor(plugins): introduce pluginsCDNBaseURL to the frontend

* Plugins CDN: Renamed "cdn base path" to "cdn url template" in backend

* Plugins CDN: lint

* merge with main

* Instrumentation: Add prometheus counter for backend hits, log from Info to Warn

* Config: Changed key from plugins_cdn.url to plugins.plugins_cdn_base_url

* CDN: Add backend tests

* Lint: goimports

* Default CDN URL to empty string,

* Do not use CDN in setImages and module if the url template is empty

* CDN: Backend: Add test for frontend settings

* CDN: Do not log missing module.js warn if plugin is being loaded from CDN

* CDN: Add backend test for CDN plugin loader

* Removed 'cdn' signature level, switch to 'valid'

* Fix pfs.TestParseTreeTestdata for cdn plugin testdata dir

* Fix TestLoader_Load

* Fix gocyclo complexity of loadPlugins

* Plugins CDN: Moved prometheus metric to api package, removed asset_path label

* Fix missing  in config

* Changes after review

* Add pluginscdn.Service

* Fix tests

* Refactoring

* Moved all remaining CDN checks inside pluginscdn.Service

* CDN url constructor: Renamed stringURLFor to stringPath

* CDN: Moved asset URL functionality to assetpath service

* CDN: Renamed HasCDN() to IsEnabled()

* CDN: Replace assert with require

* CDN: Changes after review

* Assetpath: Handle url.Parse error

* Fix plugin_resource_test

* CDN: Change fallback redirect from 302 to 307

* goimports

* Fix tests

* Switch to contextmodel.ReqContext in plugins.go

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2023-01-27 15:08:17 +01:00
Ben Sully
5ff94e528b
API: don't re-add /api suffix to grafana.com API URL (#62280)
The old GrafanaComURL setting didn't have the /api suffix so needed it
adding on by the proxy director, but the new GrafanaComAPIURL setting is
assumed to already point directly to the API and doesn't need an
additional suffix.

This is the only place in the codebase that GrafanaComAPIURL is used.
2023-01-27 10:20:55 +01:00
idafurjes
6c5a573772
Chore: Move ReqContext to contexthandler service (#62102)
* Chore: Move ReqContext to contexthandler service

* Rename package to contextmodel

* Generate ngalert files

* Remove unused imports
2023-01-27 08:50:36 +01:00
Kristin Laemmert
e8b8a9e276
chore: move dashboard_acl models into dashboard service (#62151) 2023-01-26 08:46:30 -05:00
lean.dev
7d8ec6199d
Snapshots: Add snapshot enable config (#61587)
* Add config to remove Snapshot functionality (frontend is hidden and validation in the backend)
* Add test cases
* Remove unused mock on the test
* Moving Snapshot config from globar variables to settings.Cfg
* Removing warnings on code
2023-01-26 10:28:11 -03:00
Karl Persson
95ea4bad6f
AuthN: Rebuild Authenticate so we only have to call it once in context handler (#61705)
* API: Add reqSignedIn to router groups

* AuthN: Add fall through in context handler

* AuthN: Add IsAnonymous field

* AuthN: add priority to context aware clients

* ContextHandler: Add comment

* AuthN: Add a simple priority queue

* AuthN: Add Name to client interface

* AuthN: register clients with function

* AuthN: update mock and fake to implement interface

* AuthN: rewrite test without reflection

* AuthN: add comment

* AuthN: fix queue insert

* AuthN: rewrite tests

* AuthN: make the queue generic so we can reuse it for hooks

* ContextHandler: Add fixme for auth headers

* AuthN: remove unused variable

* AuthN: use multierror

* AuthN: write proper tests for queue

* AuthN: Add queue item that can store the value and priority

Co-authored-by: Jo <joao.guerreiro@grafana.com>
2023-01-26 10:50:44 +01:00
Sofia Papagiannaki
cd27562c76
Access control: Modify dashboard/folder resolvers so that return also the inherited scopes (#62025)
* Access Control: Add folder service dependency to the dashboard/folder resolvers

* Expose the function fetching parents to folder interface

* Add generic prepend utility

* Modify dashboard resolvers to return inherited scopes
2023-01-26 10:21:10 +02:00
Ryan McKinley
a0405912a8
Preferences: Add preferences kind and remove unused navbar settings (#59621) 2023-01-25 11:00:32 -08:00
Kristin Laemmert
7c27c866f6
chore: update folder model (json tags) to match previous model (#62117)
chore: update folder model to match previous model
2023-01-25 10:04:08 -05:00
ying-jeanne
b0b2b72290
[API Split] Move star api inside of packages (#61987)
move star api inside of packages
2023-01-25 14:58:54 +00:00
Eric Leijonmarck
6bd11e0ebf
Auth: Add skip_org_role_sync setting for github (#61673)
* add: skip_org_role_sync setting for github

* fix: frontend

* rearranged tests

* refactor: assignGrafanaAdmin skip also

* Add: tests for allowGrafanaAdmin

- both for the case when both settings are set and the setting for only
  allowGrafanaAdmin

* Apply suggestions from code review

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 pkg/login/social/github_oauth.go

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

* added vairable inside scope

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

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

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-01-25 15:16:08 +01:00
idafurjes
529e6c379f
Chore: Remove Result field from dashboard snapshot mode (#62089)
Chore: Remove Result field from dashboard snapshot mode;
2023-01-25 15:09:44 +01:00
Ben Sully
bd4e3f0d16
API: Correctly use new grafana_com.api_url setting in /api/gnet proxy (#60893)
During the review of the initial PR adding this (#59506) I removed
a new global variable from the setting package, but forgot to update
the reference to the new setting, so the API URL wasn't actually
being used. This PR updates the proxy endpoint to use the API
URL correctly.

Aside: I'm not a huge fan of how the error is being ignored when parsing
the URL, but I think that should be addressed in a separate PR if anyone
has a suggestion for how we should handle it. (Should we check that the
URL is valid when parsing config?)
2023-01-25 15:23:18 +02:00
Eric Leijonmarck
143ee0c49f
Auth: Add skip_org_role_sync to GitLab OAuth (#62055)
* Auth: Add skip_org_role_sync to GitLab OAuth

- add: tests
- docs added

* Update pkg/login/social/gitlab_oauth.go

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

* fix: for import

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
2023-01-25 13:39:54 +01:00
Will Browne
eb1fed7929
Plugins: Add plugin resource tests (#62014)
* remove plugin context from response

* remove integration test indicator
2023-01-25 10:45:52 +00:00
idafurjes
b54b80f473
Chore: Remove Result from dashboard models (#61997)
* Chore: Remove Result from dashboard models

* Fix lint tests

* Fix dashboard service tests

* Fix API tests

* Remove commented out code

* Chore: Merge main - cleanup
2023-01-25 10:36:26 +01:00
idafurjes
421976e919
Chore: Remove folders from models pkg (#61853) 2023-01-25 09:14:32 +01:00
Sofia Papagiannaki
e5e8bb4dea
Chore: Use same JSON tag casing everywhere for parent UID (#61935)
Chore: Use same JSON tag casing everywhere for parent UID
2023-01-24 10:20:28 +02:00
Kristin Laemmert
fe27acc3a9
chore: move validations model into the validations service (#61953) 2023-01-23 15:10:14 -05:00
Kristin Laemmert
6e9eb0d931
chore: move plugins models into pluginsettings svc (#61944) 2023-01-23 13:56:20 -05:00
Kristin Laemmert
857649e30b
chore: move models/licensing into licensing service (#61878) 2023-01-23 11:53:43 -05:00
Jo
1037ef28a9
SupportBundles: Access control guards (#61914)
* rename routes and fix access control for support bundles

* AccessControl: Hide menu if not authorized

* AccessControl: Add AC guards for create and delete

* lint
2023-01-23 16:23:20 +00:00
Kristin Laemmert
40feee0d17
chore: move alert-related models (#61716)
* chore: move alert notification models into the alerting service (alerting/models)
2023-01-23 08:19:25 -05:00
Sofia Papagiannaki
c7a7ebd3e0
Chore: Drop search service dependency from folder service (#61789)
* Chore: Drop search service dependency from folder service
2023-01-23 14:09:09 +02:00
Karl Persson
0942e0a815
RBAC: Rewrite data source api tests (#61783)
RBAC: Rewrite datasource rbac api tests
2023-01-23 10:54:29 +01:00
Kristin Laemmert
cd08f2575a
chore: move jwt models into auth/jwt (#61862)
* chore: move jwt models into auth/jwt
2023-01-20 13:11:06 -05:00
idafurjes
68445a7c77
Chore: Remove dashboard ACL from models (#61749)
* Remove dashboard ACL from models

* Remove unused comment
2023-01-20 14:58:47 +01:00
Sofia Papagiannaki
c104cc7020
Chore: Split folder store and dashboard store interfaces (#61655)
* update folder store mock

* Split folder store and dashboard store interfaces
2023-01-19 18:38:07 +02:00
Alexander Zobnin
60ef88c918
SAML: Support auto login (#61685)
* SAML: Support auto login

* Add individual auto_login option for each OAuth provider

* Docs: Describe new auto_login option

* Minor refactor
2023-01-19 15:53:02 +01:00
Ieva
06350ed887
RBAC: remove the usage of access control mock from preference tests (#61709)
remove the usage of access control mock from preference tests
2023-01-19 14:43:00 +00:00
Karl Persson
c5c34ed95e
RBAC: Rewrite provisioning rbac tests (#61752)
* RBAC: Rewrite rbac provisioning api tests
2023-01-19 13:49:57 +01:00
Karl Persson
f38e2856d8
RBAC: Rewrite admin api test setup to not use mocked access control (#61741)
* RBAC: Rewrite admin api test setup to not use mocked access control
2023-01-19 11:36:44 +01:00
Karl Persson
f5397a7c31
RBAC: Rewrite ldap rbac tests (#61743) 2023-01-19 11:09:26 +01:00
Eric Leijonmarck
0d42edddbf
Auth: Add skip_org_role_sync setting to OAuth integration Google (#61572)
* WIP

* Add: skip_org_role_sync for Google OAuth

- add setting for frontend
- add read of config
- add config to sample and default

* add: docs

* spelling

* Update pkg/login/social/social.go

* Apply suggestions from code review

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>

* removed unnessecary line

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
2023-01-19 09:54:22 +01:00
Sofia Papagiannaki
4b634fadcf
Chore: Fix Swagger and OpenAPI specifications (#61669)
* Add go-swagger annotations for route

* Re-generate Swagger and OpenAPI specs
2023-01-18 17:49:07 +02:00
Serge Zaitsev
fa36591380
Chore: Remove mockstore and use dbtest instead (#61629)
* remove mockstore and use dbtest instead

* fix wire

* remove unused expected fields

* fix more tests in alerting

* fix api tests
2023-01-18 16:01:25 +01:00
Levente Balogh
4ef82dc73f
Connections: Show a "No access" modal if the user has no permissions (#61397)
* feat: add a new modal for displaying no-access info

* feat(CardGrid): add an onClick handler for items

* feat: open a no-access modal when clicking on a connection in the catlog

* feat: update permissions

Open a "No access" modal when the user clicks a connection type but has no permissions creating a datasource out of it

* test: add tests for opening the No Access modal

* test: fix the user permissions in tests

* Wip

* Revert "Wip"

This reverts commit 7f080c7f77.
2023-01-18 15:34:23 +01:00
juanicabanas
18e8d1e28d
PublicDashboards: Time range settings (#61585) 2023-01-18 10:54:19 -03:00
linoman
4d095547f8
Auth: Implement skip org role sync for jwt (#61647)
* Add new config option

* Add frontend control

* Condition new auth broker with config option

* Condition old auth broker with config option

Co-authored-by: Jo <joao.guerreiro@grafana.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2023-01-18 13:59:50 +01:00
idafurjes
b573b19ca3
Chore: Remove dashboards from models pkg (#61578)
* Copy dashboard models to dashboard pkg

* Use some models from current pkg instead of models

* Adjust api pkg

* Adjust pkg services

* Fix lint

* Chore: Remove dashboards models

* Remove dashboards from models pkg

* Fix lint in tests

* Fix lint in tests 2

* Fix for import in auth

* Remove newline

* Revert unused fix
2023-01-18 13:52:41 +01:00
Kristin Laemmert
f6e3252c00
chore: move notifications models into notifications service (#61638) 2023-01-17 14:47:31 -05:00
Serge Zaitsev
efed0151f8
Chore: Remove pkg/models/stats.go (#61613)
* remove pkg/models/stats.go

* rename models package in tests
2023-01-17 14:17:54 +01:00
Ieva
cd363cb037
RBAC: remove access control mock from org quota tests (#61574)
* remove ac mock from org quota tests

* fix incorrect expected status code and swap tests to make setup easier

* remove empty line
2023-01-17 10:33:01 +00:00
Karl Persson
2324597d8d
AuthN: Perform login with authn.Service (#61466)
* AuthN: Create password client wrapper and use that on in basic auth
client

* AuthN: fix basic auth client test

* AuthN: Add tests for form authentication

* API: Inject authn service

* Login: If authnService feature flag is enabled use authn login

* Login: Handle token creation errors
2023-01-17 09:11:45 +01:00
idafurjes
7c2522c477
Chore: Move dashboard models to dashboard pkg (#61458)
* Copy dashboard models to dashboard pkg

* Use some models from current pkg instead of models

* Adjust api pkg

* Adjust pkg services

* Fix lint
2023-01-16 16:33:55 +01:00
Eric Leijonmarck
c5e74ee607
Auth: Add skip_org_role_sync for AzureAD OAuth (#60322)
* [WIP] Auth: add backend skipOrgRoleSync to AzureAD OAuth

- add: skipOrgRoleSync
- rename: skipOrgRoleSync to skipOrgRoleSyncBase (to make it clear that
  it is the base version of SocialBase)
- add: tests for skipOrgRoleSync in AzureAD

TODO:
- [ ] frontend changes

* add: docs

* refactor: remove role from basicinfo

* add: settings for grafanacom

* add: settigns for frontend

* add: logic for azureAD user skip org role

* add: docs for skip_org_role_sync

* refactor: docs a bit

* add: tests for userinfo

* refactor: to only extract if skiporgrolesync false

* refactor: based on review comments

* 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-01-16 13:16:01 +01:00
Ieva
e543c10e25
RBAC: Remove RBAC mock from plugin installation tests (#61416)
remove ac mock from plugin installation tests
2023-01-13 09:34:20 +00:00
Karl Persson
b5255ebfdf
RBAC: Update org rbac tests to not use mocked access control (#61211)
* API: Rewrite legacy access control and rbac tests for current org
endpoint

* API: Rewrite legacy and rbac endpoint tests for update current and
target org

* API: rewrite access control tests for create org

* API: Rewrite delete org api access control tests

* API: rewrite search org access control tests to not use mocked access
control

* API: Rewrite get org and get org by name access control tests to not use
mocked access control


Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-01-13 10:22:32 +01:00
idafurjes
490a787d9d
Chore: Move tem member models to team pkg (#61294)
* Chore: Move tem member models to team pkg

* Fix test lint
2023-01-13 09:43:38 +01:00
Eric Leijonmarck
91322bebb5
Auth: Add skip_org_role_sync setting for GrafanaCom (#60553)
* add frontend settings and setting for grafanacom

* removed println

* add skip-org-role-sync on login

* add deprecation notice for this field

* remove println

* remove newline

* change and renamed variables

* fix for reconfiguring the settings for grafanacom

* add documentationf or grafanacom setup

* WIP tests

* added tests

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* updated steps

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

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

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

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

* doc: updated the docs to reflect what happens to grafana.com users

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

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

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

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

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

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

* add blankline

* rephrase of doc improvements for explaing of the settings

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

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

* add frontend setting for grafanacom.

* WIP tests

* refactor docs

* frontend to adhere to skipping org role sync for GrafanaCom users

* update docs to reflect desired behavior

* tests: added test for skip and nonskip

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

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

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

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

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

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

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

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

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

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

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: Jo <joao.guerreiro@grafana.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-01-12 16:44:08 +01:00
ying-jeanne
7339dbc090
Chore: Refectory of shorturl service, move models into service (#61295)
Chore: refectory of shorturl service, move models into service
2023-01-12 17:13:47 +08:00
idafurjes
f2ffce4351
Chore: Move team models to models pkg (#61262)
* Chore: Move team models to models pkg

* Fix ACL tests

* More ACL tests

* Change Id to ID in conflict user command test

* Remove team from models

* Fix ac test lint
2023-01-11 14:20:09 +01:00
idafurjes
7dcb502b33
Chore: Remove org model duplicates (#61025)
Remove org model duplicates
2023-01-09 14:39:53 +01:00
Karl Persson
3b08946fd3
RBAC: Update org invite rbac tests to not used mocked access control (#61141) 2023-01-09 12:23:24 +01:00
Karl Persson
e0c7ef3481
RBAC: Rewrite rbac annotations test (#61036)
* API: Rewrite annotation rbac tests to not use mocked access control

* API: rewrite mass deletion rbac tests
2023-01-09 09:59:14 +01:00
Alexander Zobnin
f1b5014efd
Preferences: Add pagination to org configuration page (#60896)
* Add auth labels and access control metadata to org users search results

* Fix search result JSON model

* Org users: Use API for pagination

* Fix default page size

* Refactor: UsersListPage to functional component

* Refactor: update UsersTable component code style

* Add pagination to the /orgs/{org_id}/users endpoint

* Use pagination on the AdminEditOrgPage

* Add /orgs/{org_id}/users/search endpoint to prevent breaking API

* Use existing search store method

* Remove unnecessary error

* Remove unused

* Add query param to search endpoint

* Fix endpoint docs

* Minor refactor

* Fix number of pages calculation

* Use SearchOrgUsers for all org users methods

* Refactor: GetOrgUsers as a service method

* Minor refactor: rename orgId => orgID

* Fix integration tests

* Fix tests
2023-01-09 11:54:33 +03:00
mikkancso
18f5f763a9
Connections: Align permissions for Connections page (#60725)
* protect /connection url paths with permissions

These permissions match the original ones at /datasources and /plugins

* add Connections section to navtree only if user has permissions

This commit works only when the easystart plugin is not present.
I'll see what I can do when it is present in the next commit(s).

* update datasources page permissions

The datasources page have Explore buttons on datasource entries,
therefore it makes sense to show this page for those, who can't edit or
create datasources but have explore permissions.
This applies for the traditional Editor role.

* DataSourcesList: link to edit page only if has right to write

If the user doesn't have rights to write datasources, then it's better
to not create a link from cards to the edit page. This way they won't
see the configuration of the data sources either, which is a desirable
outcome.

Also, I moved the query for DataSourcesExplore permission out from the
DataSourcesListView component in the DataSourcesList component, next to
the other permission queries - for the sake of consistency.

* fix permissions for connect data

This way it matches the permissions of the "Plugins" page.

* fix applinks test
2023-01-06 03:11:27 -05:00
idafurjes
d1c9b308bc
Chore: Move tempuser model to tempuser package (#61024)
* Move tempuser model to tempuser package

* Add xorm tags for ID
2023-01-06 09:02:05 +01:00
Karl Persson
183397194a
RBAC: rewrite team member api test to not use mock (#61040)
* RBAC: rewrite team member api test to not use mock
2023-01-05 20:08:07 +01:00
idafurjes
bb35f37b66
Chore: Delete org model duplicates (#60940)
* Delete org model duplicates

* Fix lint

* Move OrgDetailsDTO to org pkg
2023-01-04 16:20:26 +01:00
idafurjes
325f7a789e
Chore: Delete duplicate models for user (#60906)
* Delete duplicate models for user

* Use new models in some tests

* Add auth model conversion back
2023-01-03 15:25:35 +01:00
Will Browne
9aed364898
Plugins: Fix plugin query help markdown (#60485)
* refactor(pluginhelp): rewrite as functional component with useAsync

* mimic old behaviour

* feat(pluginhelp): display message if backend returned an empty string

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2023-01-03 14:20:27 +01:00
Karl Persson
5b4e1ee6fc
Oauth: Remove extra decoding of redirect url (#60875)
Oauth: remove extra decoding of redirect cookie url
2023-01-02 16:45:45 +01:00
Kristin Laemmert
6e9419ea80
chore(dashboard version service): make method sigs more consistent (#60736)
The DashboardVersion struct is the database object; the DashboardVersionDTO is the object that should be sent to the API layer.

In the future I'd like to move DashboardVersion to dashverimpl and un-export it, but there are a few places that Insert directly into that table, not all of which are test fixtures, so that should wait until we clean up at least the DashboardService's use of it.
2022-12-27 11:17:24 -05:00
ying-jeanne
12c292fd44
[Bug] Fix annotations update/patch (#60385)
* fix annotations update/patch

* verify that when update doesn't contain data, we will not update data
2022-12-26 09:53:52 -05:00
juanicabanas
9c3ddda99b
PublicDashboards: Revert Time range setting added (#60698)
Revert "PublicDashboards: Time range setting added (#60487)"

This reverts commit 6f609dbced.
2022-12-22 12:31:54 -03:00
Sofia Papagiannaki
4df78cebc2
Nested Folders: Unify folder services (#60390)
* Nested Folders: Unify folder services
2022-12-20 17:38:09 +02:00
Christian Segundo
707198227c
Auth: Log a more useful msg if no OAuth provider configured (#56722)
Log a useful msg if no oauth provider configured

When a user doesn't configure an OAuth provider and uses auto login, Grafana logs a misleading message indicating that he has multiple providers configured.
2022-12-20 14:35:43 +01:00
Sofia Papagiannaki
55b014974d
Nested folders: Refactor folder update (#60323)
* Nested folders: Refactor folder update

* Apply suggestions from code review
2022-12-20 15:00:33 +02:00
Jo
2c7410c87d
Admin: Add support bundles (#60536)
* Add support bundles

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
Co-authored-by: Kalle Persson <kalle.persson@grafana.com>

* tweak code owners

* rename and lint frontend

* lint

* fix backend lint

* register feature flag

* add feature toggle. fix small backend issues

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
Co-authored-by: Kalle Persson <kalle.persson@grafana.com>
2022-12-20 11:13:37 +01:00
juanicabanas
6f609dbced
PublicDashboards: Time range setting added (#60487)
Time range added for public dashboard: 

- Enable/Disable switch added in public dashboard configuration.
- Time range picker shown in public dashboard for viewer user
2022-12-19 17:38:37 +03:00
Sofia Papagiannaki
b1ef5ab320
Nested Folders: Support listing nested folder children (#58566)
* Nested Folders: Support listing nested folder children

* Filter out subfolders with no permissions

* Apply suggestion from code review
2022-12-19 10:52:04 +02:00
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
Marcus Efraimsson
6478d0a5ef
Plugins: Forward user header (X-Grafana-User) in backend plugin requests (#58646)
Grafana would forward the X-Grafana-User header to backend plugin request when 
dataproxy.send_user_header is enabled. In addition, X-Grafana-User will be automatically
forwarded in outgoing HTTP requests for core/builtin HTTP datasources. 
Use grafana-plugin-sdk-go v0.147.0.

Fixes #47734

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2022-12-15 15:28:25 +01:00
Ryan McKinley
cf055ab4ec
k8s: Add a dev only feature flag and simple service to get a client (#60204) 2022-12-13 07:41:16 -08:00
Domas
c2cea076ee
Chore: Add deprecation warnings for Sentry (#60165) 2022-12-13 16:41:42 +02:00
Dan Cech
fe3ae49cce
Backend: Consistently use context RemoteAddr function to determine remote address. (#60201)
consistently use context RemoteAddr function to determine remote address
2022-12-13 09:33:05 -05: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
Serge Zaitsev
af7d293eaf
Chore: Remove Store interface and use db.DB instead (#60160)
* Chore: Remove Store interface and use db.DB instead

* use old-style session exec
2022-12-13 11:03:36 +01:00
Ryan McKinley
b2c4af16d7
Git: Update experimental workflow POC (#60049) 2022-12-08 13:57:33 -05:00
Kristin Laemmert
70fbf47022
chore: remove CreateUser from sqlstore & replace with userService.CreateUserForTests (#59910) 2022-12-07 11:03:22 -05:00
Karl Persson
22be025284
Auth: Add anonymous authn client (#59637)
* Authn: Add Client interface and Reqeust and Identity structures

* Authn: Implement Authenticate method in service

* Authn: Add tracing

* Authn: Add logger

* AuthN: Implement Anonymous client
2022-12-02 15:10:03 +01:00
Will Browne
76233f9997
Plugins: Unexport PluginDir field from PluginDTO (#59190)
* unexport pluginDir from dto

* more err checks

* tidy

* fix tests

* fix dboard file tests

* fix import

* fix tests

* apply PR feedback

* combine interfaces

* fix logs and clean up test

* filepath clean

* use fs.File

* rm explicit type
2022-12-02 13:46:55 +01:00
Karl Persson
6d1bcd9f40
DataSourcePermissions: Handle licensing properly for ds permissions (#59694)
* RBAC: add viewer grand if dspermissions enforcement is not enabled

* RBAC: Change permissions based on role prefix

* RBAC: Add option to for permission service to add a license middleware

* RBAC: Remove actions from query struct
2022-12-02 13:19:14 +01:00
Sasha Melentyev
f0adc69ada
Chore: Change fmt.Errorf to errors.New when there is no formatting required (#58600)
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-12-01 20:51:12 +01:00
Marcus Efraimsson
6dbe3b555f
Plugins: Refactor forward of cookies, OAuth token and header modifications by introducing client middlewares (#58132)
Adding support for backend plugin client middlewares. This allows headers in outgoing 
backend plugin and HTTP requests to be modified using client middlewares.

The following client middlewares added:
Forward cookies: Will forward incoming HTTP request Cookies to outgoing plugins.Client 
and HTTP requests if the datasource has enabled forwarding of cookies (keepCookies).
Forward OAuth token: Will set OAuth token headers on outgoing plugins.Client and HTTP 
requests if the datasource has enabled Forward OAuth Identity (oauthPassThru).
Clear auth headers: Will clear any outgoing HTTP headers that was part of the incoming 
HTTP request and used when authenticating to Grafana.
The current suggested way to register client middlewares is to have a separate package, 
pluginsintegration, responsible for bootstrap/instantiate the backend plugin client with 
middlewares and/or longer term bootstrap/instantiate plugin management. 

Fixes #54135
Related to #47734
Related to #57870
Related to #41623
Related to #57065
2022-12-01 19:08:36 +01:00
Ryan McKinley
14a080ec12
EntityStore: Rename ObjectStore to EntityStore (part 2) (#59616) 2022-11-30 17:52:15 -05:00
Ryan McKinley
5dc7b01f9d
EntityStore: Rename ObjectStore to EntityStore (part 1) (#59613) 2022-11-30 13:42:42 -08:00