Commit Graph

284 Commits

Author SHA1 Message Date
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
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
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
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
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
Jo
580477bf8e
NGAlerting: Use identity.Requester interface instead of SignedInUser (#76360)
* unfurl SignedInUserAttrs services

* replace signedInUser with Requester

replace signedInUser with requester

* fix tests

* linting

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-11-14 14:47:34 +00:00
Ryan McKinley
3509a5abb9
FeatureFlags: Cleanup usage of cfg.IsFeatureToggleEnabled (#78014) 2023-11-13 07:55:15 -08:00
Kat Yang
c94410fdee
Chore: Deprecate FolderIds from FindPersistedDashboardsQuery (#77651)
* Chore: Deprecate FolderIds from FindPersistedDashboardsQuery

* Update pkg/services/dashboards/models.go

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

---------

Co-authored-by: Arati R. <33031346+suntala@users.noreply.github.com>
2023-11-09 11:07:10 -05:00
Kat Yang
4e57324d58
Chore: Deprecate FolderID from GetDashboardQuery (#77812) 2023-11-09 10:53:39 -05:00
Kat Yang
71a2ce5a71
Chore: Deprecate FolderID from CountDashboardsInFolderRequest (#77804)
Deprecate FolderID from CountDashboardsInFolderRequest
2023-11-08 11:27:03 -05:00
Kat Yang
bc875b4c13
Chore: Deprecate FolderID from DashboardSearchProjection (#77811) 2023-11-08 11:23:56 -05:00
Kat Yang
71dd335bf8
Chore: Deprecate FolderID in Hit (#77623)
* Chore: Deprecate FolderID in Hit

* chore: regen specs

* chore: remove accidental deprecation comment
2023-11-07 09:51:54 -05:00
Kat Yang
a7d08997f7
Chore: Deprecate folderIDs from testCases (#77649) 2023-11-07 09:51:18 -05:00
Dan Cech
db6035a843
Chore: update kind annotation names to grafana.app/* (#77401)
* update kind annotation names to grafana.app/*
2023-10-30 17:08:31 -04:00
Ieva
744f4defcf
Bug: fix a typo in dashboard permission logic (#77231)
fix an error handling typo
2023-10-26 19:39:27 +03:00
Ieva
f6e2a775d3
Bug fix: Correctly set permissions on provisioned dashboards (#77155)
* set default basic role permissions for dashboards even if dash creator permissions can't be set

* temporarily increase the test threshold until we can tweak the page
2023-10-26 17:21:50 +01: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
Dan Cech
d003ffe439
Update origin annotation names (#76301)
* Update origin annotation names

k8s does not support annotation names with multiple slashes in them, so this PR updates the origin annotations to match the format for updated and created annotations.

* fix tests
2023-10-11 18:28:26 -04:00
Jo
41bcb5e07f
Identity: Port folder library to identity.Requester (#76105)
Port folders to identity.Requester
2023-10-06 15:02:34 +02: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
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
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
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
Ieva
ca46a5c1af
Chore: prepare for removing RBACenabled config option (#73845)
prepare for removing RBACenabled config option
2023-08-25 17:13:46 +02:00
Karl Persson
31df4db1d3
Dashboards+Folder: remove unused function MakeUserAdmin (#73635)
* Dashboards+Folder: remove unused function MakeUserAdmin

* Remove dead branch
2023-08-23 12:54:06 +02:00
Dan Cech
dd97038b00
Slug: Combine various slugify fixes for special character handling (#73164)
* combine various slugify fixes for special character handling

* a couple more test cases

* update more tests

* goimports
2023-08-10 16:12:50 -04: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
Sofia Papagiannaki
1f742fcf93
Guardian: Split dashboard and folder guardian implementation (#69722)
* Split dashboard and folder guardian implementations

* Replace guardian constructors

* Simplify tests

* Add tests

* Apply suggestion from code review

Differentiate errors for dashboard and folders

* Remove tests for general folder

* Add tests for general scope
2023-07-25 15:31:12 +03:00
Arati R
20ffbbc41e
NestedFolders: Add library panels counting and deletion to folder registry (#69149)
* Expose library element service's folder service
* Register library panels, add count implementation
* Expand folder counts test
* Update registry deletion method interface
* Allow getting library elements from any folder
* Add test for library panel deletion
* Add test for library panel counting
2023-07-25 13:05:53 +02:00
Ryan McKinley
10ea92fa09
Schemas: minor updates from the k8s branch (#71688)
Co-authored-by: sam boyer <sdboyer@grafana.com>
2023-07-21 19:17:11 +03:00
Ieva
25c4292a5f
RBAC: search v1 permission filter part 1 - cleanup & updating tests (#71913)
* update tests and remove some AC disabled checks

* remove test for old permission filter builder
2023-07-19 10:37:27 +01:00
Emil Tullstedt
5c19272065
Slug: Use urlencoding to support non-ASCII characters (#70691) 2023-07-10 21:05:39 +02:00
Jo
a7aca983a5
AccessControl: Fix nuid permission deletion when deleting dashboards and folders (#71225)
* fix nuid permission deletion when deleting dashboards and folders

* fix lint
2023-07-10 11:12:04 +02:00
Kat Yang
67cdae4b7d
Fix: Change getExistingDashboardByTitleAndFolder to get dashboard by title, not slug (#70723)
* Fix: Change getExistingDashboardByTitleAndFolder to get dashboard by title, not slug

* test: add tests for get dashboard with existing name, get dashboard with non existing name, get dashboard with existing name in a folder

* Update pkg/services/dashboards/database/database_test.go

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

* require specific error for Should be able to get dashboard with existing name

* Update pkg/services/dashboards/database/database_test.go

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

* implement sofia suggestions to check for specific err, remove logs

* give test more specific name

* implement daniel suggestion of formatting documentation comment in safe way

* fix test title to refer to root directory not specific folder

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-06-29 16:15:38 -04:00
Arati R
6cb1a5e368
Nested folders: Add alert rule counts and deletion to folder registry (#67259)
* Let alert rule service implement registry service
* Add count method to RuleStore interface
* Add implementation for deletion of alert rules
* Rename uid to folderUID in registry methods
* Check forceDeleteRule value for registry deletion
* Register alerting store with folder service
* Move folder test functions to separate package
* Add testing for alert rule counting, deletion
* Remove redundant count method
* Fix deleteChildrenInFolder signature
* Update pkg/services/ngalert/store/alert_rule.go
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* Add tests for nested folder deletion
* Refactor TestIntegrationNestedFolderService
* Add rules store as parameter for alertng provider

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-06-02 16:38:02 +02:00
17billion
6d9db92a07
Dashboards: Improve delete dashboard performance due to slow annotations query (#68544)
* Add index on dashboard_id column in annotation table

* Added org_id condition to the delete query for dashboard deletion.
2023-06-01 15:31:03 +03:00
Ryan McKinley
c66d5721f7
Kinds: Use apimachinery ObjectMeta for metadata (#68668) 2023-05-24 09:13:44 -07:00
Ieva
9439649a4c
RBAC: remove unused dash and folder permission logic (#68968)
remove unused HasAdmin and HasEdit permission methods
2023-05-24 15:33:35 +01:00
Ieva
b1382ac48e
RBAC: Do not search for parents of the root folder (#67746)
do not search for parents of the general folder
2023-05-04 09:36:36 +01:00
Ieva
3303428083
Provisioning: Fix provisioning issues with legacy alerting and data source permissions (#67308)
extend provisioner permissions
2023-04-27 11:35:39 +01:00
Arati R
fd434cab58
NestedFolders: Add API endpoint for descendant count in a folder (#66550)
* Add CountInFolder to RegistryService interface
* Add folder children counts api route
* Update fake GetFolderChildrenCounts
* Add test for getting folder children counts
* Add validation to folder children counts handler
* Update openapi specs
* Update pkg/services/folder/folderimpl/folder.go
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>

---------

Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
2023-04-24 15:57:28 +02:00
Eric Leijonmarck
b6953763f4
RBAC: Update dashboardIntegrationFolder tests to use RBAC (#66845)
* wip

* tests fixed

* clean up tests

* updated tests since evaluation only happens on scenario setup

* delete debugging files
2023-04-21 15:08:52 +01: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