* 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
* make sure that user permission cache is cleared after new dashboard and folder creation
* more test fixes
* Update pkg/services/dashboards/service/dashboard_service.go
* check identity type in SetDefaultPermissionsAfterCreate, set default permissions for service accounts
* set SA permissions for folders as well
* fix tests
* 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>
* Unistore: Ensure deprecated Folder ID gets stored on all modes
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
---------
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
* Zanzana: Remove usage from legacy access control
* remove unused
* remove zanzana client from services where it's not used
* remove unused metrics
* fix linter
Refactor folder service to use Unified Storage
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
---------
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
* Ensure all internal Services are using FolderService and not FolderStore
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
---------
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
* 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>
* get stats from index
* fix logging
* fix logging
* actually counting
* Use searcher to check for resources referencing a folder
* Add tests when deleting a folder
* Lint
* merge/fix test
* will delegate to SQL
* get stats from index
* fix logging
* actually counting
* merge/fix test
* will delegate to SQL
* Uncomment test
* Add tests for checking stats before deleting a folder
* Change base branch to main
* Lint
* [REVIEW] remove logs
* Check for type assertion success
---------
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
* Add route for update folders via apiserver
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
---------
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>