Commit Graph

3574 Commits

Author SHA1 Message Date
Marcus Efraimsson
fe3e5917f1
Plugins: Preserve trailing slash in plugin proxy (#86859)
* Plugins: Preserve trailing slash in plugin proxy

* enable toggle by default
2024-06-05 13:36:14 +02:00
Andres Martinez Gotor
60ce523b72
Refactor plugin context initialization (#88343) 2024-05-28 16:59:06 +03:00
Tim Levett
b5cf90ce78
API: Add in theme support to /render/* endpoint (#88304)
add in theme support to render endpoint
2024-05-24 14:12:31 -05:00
Ryan McKinley
ffc2702552
Plugins: Support Admission validation hooks (#87718) 2024-05-24 18:45:16 +03:00
Juan Cabanas
a85c1b69d5
PublicDashboards: Remove publicDashboardUid from DashboardMeta (#85126) 2024-05-23 11:21:21 -03:00
Ieva
bd2b248f0e
RBAC: Clean up action set code (#88147)
* remove unused action set code, refactor the existing code

* fix import ordering

* use a separate interface for permission expansion after all, to avoid circular dependencies

* add comments, fix a test
2024-05-23 12:14:01 +01:00
Mathieu Parent
b8c9ae0eb7
OIDC: Support Generic OAuth org to role mappings (#87394)
* Social: link to OrgRoleMapper

* OIDC: support Generic Oauth org to role mappings

Fixes: #73448
Signed-off-by: Mathieu Parent <math.parent@gmail.com>

* Handle when getAllOrgs fails in the org_role_mapper

* Add more tests

* OIDC: ensure orgs are evaluated from API when not from token

Signed-off-by: Mathieu Parent <math.parent@gmail.com>

* OIDC: ensure AutoAssignOrg is applied with OrgMapping without RoleAttributeStrict

Signed-off-by: Mathieu Parent <math.parent@gmail.com>

* Extend docs

* Fix test, lint

---------

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Co-authored-by: Mihaly Gyongyosi <mgyongyosi@users.noreply.github.com>
2024-05-23 09:55:45 +02:00
Ieva
3e77768144
RBAC: Expand action sets when fetching permissions (#87967)
* logic to expand action set to the underlying actions when permissions are fetched from the DB

* updates needed for dependency injection

* clean up some code, also deduplicate scopes when grouping scopes and actions

* expand on a comment

* rename a method
2024-05-21 15:09:26 +01:00
Aaron Godin
0072e4a92d
Update DS Proxy to use RBAC action (#87517)
iam-team: Update DS Proxy to use RBAC action
2024-05-21 08:05:16 -05:00
Ezequiel Victorero
42d75ac737
Dashboards: Add feature restore dashboards backend (#83131)
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2024-05-16 14:36:26 -03:00
Andres Martinez Gotor
d8904f3ca4
Add apiVersion to plugin models (#87510) 2024-05-14 13:58:27 +02:00
Ezequiel Victorero
c9c6445554
Chore: Refactor render via http (#84613) 2024-05-14 07:24:18 -03:00
Karl Persson
0f3080ecb8
AuthN: Fix signout redirect url (#87631)
* Add missing return

* Use sign out redirect url from auth config if configured

* remove option from auth.jwt that is not used
2024-05-12 19:53:19 +02:00
Ieva
167151b211
Chore: Remove use of deprecated method in AC code (#87541)
* switch from using cfg to using featuremgmt for checking a feature toggle in AC code

* merge test fixes
2024-05-10 11:56:52 +01:00
Ieva
105313f5c2
RBAC: Adding action set resolver for RBAC evaluation (#86801)
* add action set resolver

* rename variables

* some fixes and some tests

* more tests

* more tests, and put action set storing behind a feature toggle

* undo change from cfg to feature mgmt - will cover it in a separate PR due to the amount of test changes

* fix dependency cycle, update some tests

* add one more test

* fix for feature toggle check not being set on test configs

* linting fixes

* check that action set name can be split nicely

* clean up tests by turning GetActionSetNames into a function

* undo accidental change

* test fix

* more test fixes
2024-05-09 10:18:03 +01:00
Karl Persson
be5ced4287
Identity: Use typed version of namespace id (#87257)
* Remove different constructors and only use NewNamespaceID

* AdminUser: check typed namespace id

* Identity: Add convinient function to parse valid user id when type is either user or service account

* Annotations: Use typed namespace id instead
2024-05-08 14:03:53 +02:00
Alexander Zobnin
82dea4b3e5
Access control: Cache basic roles and teams permissions (#87043)
* RBAC: Cache basic roles permissions

* Cache teams permissions

* Set cache TTL to 1 minute

* Add OSS implementation

* Fetch basic role permissions correctly

* fix conflict_user_command

* Fix teams permissions query

* Add traces for GetUserPermissions

* Fix folders tests

* Fix colflict user command

* Update store mock

* Fix linter error

* Reuse GetUserPermissions for fetching basic roles

* tests for GetTeamsPermissions

* pre-allocate slice capacity

* Fix linter
2024-05-07 15:23:11 +02:00
Aaron Godin
0bc8992dfa
Revert #86466 (#87405)
Revert "Apply plugin route ReqAction to ds_proxy authorization (#86466)"

This reverts commit 53f94ac50d.
2024-05-06 14:40:32 -05:00
Dan Cech
41bee274fd
Chore: Fix error handling in postDashboard, remove UserDisplayDTO, fix live redis client initialization (#87206)
* clean up error handling in postDashboard and remove UserDisplayDTO

* replace GetUserUID with GetUID and GetNamespacedUID, enforce namespace constant type

* lint fix

* lint fix

* more lint fixes
2024-05-06 14:17:34 -04:00
Jon Cole
8e96821c16
Azure: get custom cloud list from grafana-azure-sdk-go package (#86717)
* Get custom cloud list from grafana-azure-sdk-go for frontend settings

* Remove getAzureClouds() and call CustomClouds() directly

* remove unused type
2024-05-04 13:17:51 +03:00
Karl Persson
d8fbbdefea
Identity: Use typed namespace id (#87121)
* Use typed namespace id
2024-05-02 14:50:56 +02:00
Serge Zaitsev
ad5613d7d4
Chore: Remove cfg from folder service (#87212)
remove cfg from folder service
2024-05-02 13:18:54 +02:00
Aaron Godin
53f94ac50d
Apply plugin route ReqAction to ds_proxy authorization (#86466)
* Apply plugin route ReqAction to ds_proxy authorization

Co-authored-by: Eric Leijonmarck <eleijonmarck@users.noreply.github.com>

* fix: move ds_proxy route Evaluator out of plugins pkg

* move DataSourceProxy route authorization to method

---------

Co-authored-by: Eric Leijonmarck <eleijonmarck@users.noreply.github.com>
2024-04-30 09:19:34 -05:00
Karl Persson
a2cba3d0b5
User: Add tracing (#87028)
* Inject tracer in tests

* Annotate with traces

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2024-04-30 13:15:56 +02:00
Ieva
cee713e34c
Chore: Add tracing to team service (#86999)
* add tracing to team service

* another test fix

* pass in context for team creation and membership checking
2024-04-29 11:32:03 +01:00
Karl Persson
c4cfee8d96
User: support setting org and help flags though update function (#86535)
* User: Support setting active org through update function

* User: add support to update help flags through update function
2024-04-29 08:53:05 +02:00
Serge Zaitsev
522a98c126
Chore: Make Cfg field private in SQLStore (#85593)
* make cfg private in sqlstore

* fix db init in tests

* fix case

* fix folder test init

* fix imports

* make another Cfg private

* remove another Cfg

* remove unused variable

* use store cfg, it has side-effects

* fix mutated cfg in tests
2024-04-24 10:38:40 +02:00
Karl Persson
0fa983ad8e
AuthN: Use typed namespace id inside authn package (#86048)
* authn: Use typed namespace id inside package
2024-04-24 09:57:34 +02:00
Eric Leijonmarck
ddabef9895
RBAC: Add actionsets struct and write path (#86108)
* Add actionsets struct and failing test

* update from review

* review comments

* review comments update

* refactor: create interface

* actionset service

* fix tests

* move from wireoss to wire

* Apply suggestions from code review

remove unnecessary comments

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

* nil for the actionsetservice

* Revert "nil for the actionsetservice"

This reverts commit e3d3cc8171.

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-04-19 15:38:14 +01:00
Alex Khomenko
44e1bce55a
Feature toggles: Remove dashboardEmbed toggle (#86587) 2024-04-19 12:48:08 +02:00
Ryan McKinley
5a8384a245
QueryService: Add feature toggles to better support testing (#86493) 2024-04-19 12:26:21 +03:00
Sofia Papagiannaki
aa825f5dee
Chore: Fix Swagger/OpenAPI instructions (#86541)
Update README.md
2024-04-19 09:16:38 +03:00
Andres Martinez Gotor
eac02a61e1
Return plugin error when requesting settings (#86052) 2024-04-18 14:29:02 +02:00
Karl Persson
1a6777cb93
User: use update function for password updates (#86419)
* Update password through Update function instead

* Remove duplicated to lower

* Refactor password code
2024-04-17 15:24:36 +02:00
Ieva
036f826b87
AuthZ: Further protect admin endpoints (#86285)
* only users with Grafana Admin role can grant/revoke Grafana Admin role

* check permissions to user amdin endpoints globally

* allow checking global permissions for service accounts

* use a middleware for checking whether the caller is Grafana Admin
2024-04-16 15:48:12 +01:00
Karl Persson
0f06120b56
User: Clean up update functions (#86341)
* User: remove unused function

* User: Remove UpdatePermissions and support IsGrafanaAdmin flag in Update function instead

* User: Remove Disable function and use Update instead
2024-04-16 16:33:50 +02:00
Charandas
2aedd9dacf
K8s: add ID token to requests outbound to new query endpoint (#86214) 2024-04-15 20:34:20 +02:00
linoman
51da96d94e
Auth: Add IsClientEnabled and IsEnabled for the authn.Service and authn.Client interfaces (#86034)
* Add `Service. IsClientEnabled` and `Client.IsEnabled` functions

* Implement `IsEnabled` function for authn clients

* Implement `IsClientEnabled` function for authn services
2024-04-15 10:54:50 +02:00
Karl Persson
895222725c
Session: set authID and authenticatedBy (#85806)
* Authn: Resolve authenticate by and auth id when fethcing signed in user

* Change logout client interface to only take Requester interface

* Session: Fetch external auth info when authenticating sessions

* Use authenticated by from identity

* Move call to get auth-info into session client and use GetAuthenticatedBy in various places
2024-04-11 10:25:29 +02:00
Alexander Zobnin
3127566a20
Access control: Use ResolveIdentity() for authorizing in org (#85549)
* Access control: Use ResolveIdentity() for authorizing in org

* Fix tests

* Fix middleware tests

* Use ResolveIdentity in HasGlobalAccess() function

* remove makeTmpUser

* Cleanup

* Fix linter errors

* Fix test build

* Remove GetUserPermissionsInOrg()
2024-04-10 12:42:13 +02:00
idafurjes
5c4a2de59b
Add FolderUID for library elements (#83819)
* Revert "Revert "Add FolderUID for library elements" (#83776)"

This reverts commit 0dfdb2ae47.

* Fix bug, dashboard id and library element fodler_id are the corresponding values
Dashboard table hold both dahboards and tables
2024-04-09 12:27:43 +02:00
Karl Persson
ba41954854
Email: trigger email verification flow (#85587)
* Add email and email_verified to id token if identity is a user

* Add endpoint to trigger email verification for user

* Add function to clear stored id tokens and use it when email verification is completed
2024-04-05 12:05:46 +02:00
Dave Henderson
5687243d0b
Feature Flags: use FeatureToggles interface where possible (#85131)
* Feature Flags: use FeatureToggles interface where possible

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* Replace TestFeatureToggles with existing WithFeatures

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
2024-04-04 12:22:31 -04:00
Serge Zaitsev
faa1244518
Chore: Replace sqlstore with db interface (#85366)
* replace sqlstore with db interface in a few packages

* remove from stats

* remove sqlstore in admin test

* remove sqlstore from api plugin tests

* fix another createUser

* remove sqlstore in publicdashboards

* remove sqlstore from orgs

* clean up orguser test

* more clean up in sso

* clean up service accounts

* further cleanup

* more cleanup in accesscontrol

* last cleanup in accesscontrol

* clean up teams

* more removals

* split cfg from db in testenv

* few remaining fixes

* fix test with bus

* pass cfg for testing inside db as an option

* set query retries when no opts provided

* revert golden test data

* rebase and rollback
2024-04-04 15:04:47 +02:00
Jo
5340a6e548
Auth: Extended JWT client for OBO and Service Authentication (#83814)
* reenable ext-jwt-client

* fixup settings struct

* add user and service auth

* lint up

* add user auth to grafana ext

* fixes

* Populate token permissions

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

* fix tests

* fix lint

* small prealloc

* small prealloc

* use special namespace for access policies

* fix access policy auth

* fix tests

* fix uncalled settings expander

* add feature toggle

* small feedback fixes

* rename entitlements to permissions

* add authlibn

* allow viewing the signed in user info for non user namespace

* fix invalid namespacedID

* use authlib as verifier for tokens

* Update pkg/services/authn/clients/ext_jwt.go

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* Update pkg/services/authn/clients/ext_jwt_test.go

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* fix parameter names

* change asserts to normal package

* add rule for assert

* fix ownerships

* Local diff

* test and lint

* Fix test

* Fix ac test

* Fix pluginproxy test

* Revert testdata changes

* Force revert on test data

---------

Co-authored-by: gamab <gabriel.mabille@grafana.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2024-04-02 17:45:15 +02:00
Will Browne
257cc98062
Datasources: Remove unused functions (#85473)
* cleanup unused funcs

* remove more stuff
2024-04-02 16:19:52 +02:00
Karl Persson
73e426b081
User: email verification completion (#85259)
* TempUser: Include InvitedById in TempUserDTO

* Extract email verfication completion flow to service
2024-03-28 16:05:33 +01:00
Karl Persson
152cb47692
AuthN: Add IsAuthenticatedBy to identity interface and replace checks (#85262)
Add IsAuthenticatedBy to identity interface and replace checks
2024-03-27 15:22:13 +01:00
Jo
7649d93d17
AuthProxy: Fix missing session for ldap auth proxy users (#85090)
fix missing session for ldap auth proxy users
2024-03-26 09:24:24 +01:00
Bruno
a2e21eac8c
Cloud migrations: create endpoint to create an access token (#84690)
* fix merge conflicts

* make token expiration configurable
2024-03-25 12:43:28 -03:00