93 Commits

Author SHA1 Message Date
feaaf96269 RBAC: Remove folder guardians part 2 (#104645)
* replace usage of folder guardians with access control evaluators

* remove NewByFolderUID guardian

* bring up to date

* fix test

* more test fixes, and don't fetch the folder before evaluating lib element access

* change what error is returned

* fix alerting test

* try to fix linter errors

* replace the use of newByFolder guardian with direct access control evaluator checks

* remove newByFolder guardian

* remove unintentional changes

* remove unintentional changes

* undo unwanted change
2025-05-17 00:25:07 +03:00
0283c98e30 K8s/Folders: Use v1beta1 and app-sdk based spec (#103975) 2025-04-14 23:20:10 +03:00
f5ad1ef69b K8s: Folders: Add v1 api (#103842) 2025-04-11 13:09:52 +01:00
73436e3d55 RBAC: Remove dashboard guardians pt 3 (#102558)
* remove usage of New dashboard guardian

* fix tests
2025-03-21 10:44:16 +00:00
927f7befd6 Unistore: Create default permissions through Folder APIServer (#101420)
* Unistore: Declare a new storage to set default folder permissions

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Remove the setting of default permissions from folder legacy storage

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Disable setting of folder permissions when Api Server is enabled

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Reverts grafana/grafana#100019

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Add unit test

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* check error on unit test

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Add unit test

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Remove unused fields

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Add unit tests for folder_storage

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Remove duplicated import

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

* Fix unit test

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

---------

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
2025-03-11 11:33:08 +00:00
3e6f40c873 K8s: Move to one feature toggle for folders and dashboards (#100911) 2025-02-19 01:11:26 +02:00
a037c6f344 K8s/Folders: Remove kubernetesFolders flag and full path metadata (#99256)
* remove full path

* remove more

* remove KubernetesFolders tests

* remove feature toggles

* remove feature toggles

* skip permissions test

* skip permissions test

---------

Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
2025-01-23 17:25:03 +03:00
bdb4725768 UserDisplay: Handle both service accounts and user names when resolving "createdBy" (#98719)
* Handle both user and service accounts when resolving identity name for dashboards and folders

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
2025-01-10 10:06:59 +01:00
6683cdc082 K8s: Update from v0.31.3 to v0.32.0 (#98507) 2025-01-06 18:20:35 +03:00
fec5c0ec19 Make sure annotations are kept when updating a folder (#98321)
* Make sure annotations are kept when updating a folder

* Remove pointer

* Mock get on update tests
2024-12-27 13:51:10 +01:00
2e08092a34 UniStore: Get Folder Handler return Root Folder (general) (#98127)
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
2024-12-18 22:31:55 -03:00
62c1735a61 Implement k8s count handler (#97955)
* Implement k8s count handler

* Fix endpoint

* Fix type converstions

* Add tests for foldercounts

* Add more tests

* Only use sql-fallback if no values in unistore

* Update gomod

* Fix test

* Update pkg/api/folder_test.go

Co-authored-by: Bruno Abrantes <bruno.abrantes@grafana.com>

* Go.mod

---------

Co-authored-by: Bruno Abrantes <bruno.abrantes@grafana.com>
2024-12-16 14:08:29 +01:00
7fd8877439 Unistore: Update Folders Endpoint (#97317)
* Add route for update folders via apiserver

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>

---------

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
2024-12-03 15:33:01 -03:00
6d04023aa6 K8s/Folders: Improve k8s client implementation of get (#96434)
* Enable getting folders with kubernetes client
* Add TestIntegrationFolderGetPermissions
* Set full path as part of legacy get
* Replace implementation for setting fullpath
* Add folder get test
* Escape forward slash in parent titles
* Replace test for access control metadata
* Add test case to TestIntegrationFolderGetPermissions
* Improve fetching of access control
2024-11-26 16:20:00 +02:00
cc6d057a18 Provisioning: Rename k8s origin metadata to repo (#96524) 2024-11-15 17:26:14 +03:00
2f40fd6741 Dashboards: Remove unique name constraints (#90687) 2024-10-29 08:58:39 +03:00
261be0facd UniStore: Evaluate Folder DTO attributes (#93968)
* UniStore: Evaluate Folder DTO attributes

* Handle AccessControl

* Reduce the number of parameters to newToFolderDto

* Detach Metadata helpers from HTTPServer

* Add tests

---------

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
2024-10-07 12:08:16 +02:00
cfe8317d45 Add auth spans and remove deduplication code for scopes (#89804)
Adds more spans for timing in accesscontrol and remove permission deduplicating code after benchmarking

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
Co-authored-by: Dave Henderson <dave.henderson@grafana.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2024-07-02 22:08:57 -08:00
1caaa56de0 FeatureFlags: Use interface rather than manager (#80000) 2024-01-09 10:38:06 -08:00
3770daabe2 Remove deprecated FolderID from api tests (#79466)
* Remove deprecated FolderID from api tests

* Removed unused const
2023-12-20 15:12:05 +01:00
31fb38723d Chore: Remove FolderID from DTO Folder (#78420)
* Chore: Remove FolderID from DTO Folder

* chore: add OrgID field to an instance of SaveDashboardCommand

* chore: add another OrgID to pair with the FolderUID:

* chore: add OrgId to Folder struct and expectedParentOrgIDs to testCase struct, unsure if last part is necessary

* Fix folder test, add expected orgID

* chore: regen specs

---------

Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
2023-12-07 13:56:04 +01:00
550746be71 Fix capitalising Folder structs (#79207)
* Fix capitalising Folder structs

* Add swagger and fix api dashboard test

* Add swagger files with bingo installed
2023-12-07 13:15:58 +01:00
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
a640d9d395 Chore: Deprecate Id from Folder in DTOs (#77943)
* Chore: Deprecate Id from Folder in DTOs

* chore: regen spec
2023-11-15 10:29:49 -05:00
9fcee9b206 Nested folders: Fix folder hierarchy in folder responses (#74516)
Nested folders: Fix hierarchy in folder response
2023-09-08 10:43:41 +03:00
ca46a5c1af Chore: prepare for removing RBACenabled config option (#73845)
prepare for removing RBACenabled config option
2023-08-25 17:13:46 +02:00
7dbcd5ecd0 NestedFolders: Return full folder hierarchy in Folder response (#66835)
* Delete redundant struct

* Include parent folders in DTO

* Add test

* Update swagger
2023-04-25 11:22:20 +03:00
5d7433d820 RBAC: Make access control metadata for folders work with nested folders (#66464)
* remove metadata for single folder listing

* extendTests

* remove ac metadata from dash and folder search results

* remove test

* remove one more test

* put ac metadata back for single folder API responses

* extend tests

* remove ac metadata from folder frontend object

* undo unneeded change

* PR feedback

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

---------

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2023-04-21 15:05:11 +01:00
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
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
Jo
6b6cf5f4b7 Cfg: Move ViewersCanEdit into cfg (#64876)
move ViewersCanEdit into cfg
2023-03-16 10:54:01 +01:00
b1e58eb47e Chore: Replace short UID generation with more standard UUIDs (#62731) 2023-02-06 20:44:37 -05:00
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
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
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
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
421976e919 Chore: Remove folders from models pkg (#61853) 2023-01-25 09:14:32 +01:00
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
68445a7c77 Chore: Remove dashboard ACL from models (#61749)
* Remove dashboard ACL from models

* Remove unused comment
2023-01-20 14:58:47 +01:00
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
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
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
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
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
a8bae3f0b0 Access Control: Clear user's permission cache after resource creation (#59101)
* refresh user's permission cache after resource creation

* clear the cache instead of reloading the permissions

* don't error if can't clear cache

* fix tests

* fix tests again
2022-11-24 14:38:55 +00:00
9855e74b92 Chore: Refactor quota service (#58643)
Chore: Refactor quota service (#57586)

* Chore: refactore quota service

* Apply suggestions from code review
2022-11-14 21:08:10 +02:00
080ea88af7 Nested Folders: Support getting of nested folder in folder service wh… (#58597)
* Nested Folders: Support getting of nested folder in folder service when feature flag is set

* Fix lint

* Fix some tests

* Fix ngalert test

* ngalert fix

* Fix API tests

* Fix some tests and lint

* Fix lint 2

* Fix library elements and panels

* Add access control to get folder

* Cleanup and minor test change
2022-11-11 14:28:24 +01:00
bf5a08e039 API: Support creating a nested folder (#58508)
* API: Support nested folder creation

* Update swagger

* fixup

* Update pkg/api/dtos/folder.go

Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>

* Fix some tests

* create legacy folder url from title and uid

Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>
Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
2022-11-10 04:41:03 -05:00
accb4dea55 [Nested Folder] Delete folder methode (#58444)
* transfer DeleteFolder changes from larger PR

* finish some thingies

* add the simplest delete logics

* some intermedia steps

* fix tests

* add test

* fix some comments

Co-authored-by: yangkb09 <yangkb09@gmail.com>
2022-11-10 03:42:32 -05:00
96cdf77995 Revert "Chore: Refactor quota service (#57586)" (#58394)
This reverts commit 326ea86a579ed927b1999bba5f2c0a35e26506d9.
2022-11-08 11:52:07 +02:00