* 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
* Return FolderReference instead of Folder on GetChildren
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
---------
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
* 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>
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>
* Handle both user and service accounts when resolving identity name for dashboards and folders
Co-authored-by: Misi <mgyongyosi@users.noreply.github.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>
* Put move and counts behid a feature flag
* Gen toggles
* Generate feature flag
* Make feature name more explicit
* Remove unused code
* Update toggle name
* 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>
* Add route for update folders via apiserver
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
---------
Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
* 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
* Support delete endpoint for folders
* Include authorizer
* Add test for delete verb
* Add delete command to delete options
* Pass query string to context to admission
* Dont support nested folder deletion for now
* Skip test if feature flag is present
* Add test case
* Remove comment
* Only rely on the storage type config to run alerting tests
* Dont change legacy subpath
* Remove unised function
* Add test case when an editor can delete alert rules
* Lint
* Fix toDTO
* Remove conversion function for folder dto
* Convert toDTO to a standalone function
---------
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
* add user ID API translation
* add uid to user frontend
* use users' UIDs in admin pages
* fix ldapSync page
* use global user search for user by UID
* remove active org filtering
* remove orgID params
* Fix folder status error message
* Add test for folder creation response message
* Add TestFoldersCreateAPIEndpointK8S fixes
* Fix message returned when user has no permissions
* Support getting full path of UIDs
* Use full path to set parents field
* Update get folder test
* Add folder store test for getting with full path UIDs
* Add test for parsing parent titles
* Test nested folder create payload
* Add parents field to folder DTO
* Allow subfolder creation when folder flag is enabled
* Update UnstructuredToLegacyFolder
* Include parents field when creating folder
* Add folder store to dashboard permissions
* Include folder store in annotation scope resolver
* Add folder store when initialising library elements
* Include folder store in search v2 service initialisation
* Include folder store in GetInheritedScopes
* Add folder store to folder permissions provider
* Include cfg, folder permissions in folder service
* Move setting of folder permissions for folder service create method
* Add separate folder registration function
* Convert to k8s resource directly after legacy create
* Use create command when creating folders
* Set additional fields when converting to k8s resource
* Add created/updated timestamps during conversion
* Refactor UnstructuredToLegacyFolderDTO
* Return errors when doing k8s conversions
* Refactor identity struct to store type in separate field
* Update ResolveIdentity to take string representation of typedID
* Add IsIdentityType to requester interface
* Use IsIdentityType from interface
* Remove usage of TypedID
* Remote typedID struct
* fix GetInternalID
* Cfg: Move rbac settings to own struct
* Cfg: Add setting to control if resource should generate managed permissions when created
* Dashboards: Check if we should generate default permissions when dashboard is created
* Folders: Check if we should generate default permissions when folder is created
* Datasource: Check if we should generate default permissions when datasource is created
* ServiceAccount: Check if we should generate default permissions when service account is created
* Cfg: Add option to specify resources for wich we should default seed
* ManagedPermissions: Move providers to their own files
* Dashboards: Default seed all possible managed permissions if configured
* Folders: Default seed all possible managed permissions if configured
* Cfg: Remove service account from list
* RBAC: Move utility function
* remove managed permission settings from the config file examples, change the setting names
* remove ini file changes from the PR
* fix setting reading
* fix linting errors
* fix tests
* fix wildcard role seeding
---------
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: jguer <me@jguer.space>
* filter the k6 folder out in the SQL queries rather than during post processing to ensure that the correct number of results is always returned
* linting
* iam-716 - prevent a folder move operation when the folder's uid or any of its parents uids begin with k6-app
* fox folder move check and only list non-k6 folders to users
* adding tests for moving
* add a test for listing folders
* fix the other tests
* use method that adds folder parent
---------
Co-authored-by: IevaVasiljeva <ieva.vasiljeva@grafana.com>
* Folders: Allow listing folders with write permission
* Check for subfolder access if parent does not have
* Add test
* GetFolders: fix ordering
* Apply suggestion from code review
* Swagger: Re-generate the enterprise specification if enterprise is cloned successfully
* API change to trigger the swagger CI step execution
* Swagger: Silence logs
* Chore: Replace response status with const var
* Apply suggestions from code review
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
* Add net/http import
---------
Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>