3
0
mirror of https://github.com/grafana/grafana.git synced 2025-02-25 18:55:37 -06:00
Commit Graph

33 Commits

Author SHA1 Message Date
Ieva
dc9e590b7b
RBAC: Return the underlying error instead of internal server or bad request for managed permission endpoints ()
* return not found instead of an internal server error when listing/updating permissions

* openapi gen
2024-01-25 16:24:52 +00:00
Marcus Efraimsson
6768c6c059
Chore: Remove public vars in setting package ()
Removes the public variable setting.SecretKey plus some other ones. 
Introduces some new functions for creating setting.Cfg.
2024-01-23 12:36:22 +01:00
Julien Duchesne
c7f515b9b2
fix(swagger): POST -> GET method for two access control endpoints ()
Missed those here: https://github.com/grafana/grafana/pull/80053
2024-01-05 09:40:08 -05:00
Julien Duchesne
5e74c19628
fix(swagger): Add new access control endpoints ()
There were a few errors that prevented these endpoints (which are the most up-to-date ones) from being present in the openapi spec:
- The `enterprise` tag excluded the endpoints from being generated
- `okRespoonse` typo
- Invalid templating on the parameters
- Missing parameter structs
2024-01-05 08:12:01 -05:00
Aaron Godin
eb490193b9
[IAM] - Add swagger docs for resource permissions API ()
* IAM: Apply swagger-go comments for generating docs on resource permissions endpoints

* Update pkg/services/accesscontrol/resourcepermissions/api.go

Clarifies swagger note on assigning to service accounts

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

---------

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2023-12-18 16:47:17 -06:00
Jo
4474f19836
Service Accounts: Enable adding folder, dashboard and data source permissions to service accounts ()
* Add SAs to Datasource permissions

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

* add SAs to dashboards/folders managed permissions

* Update public/app/core/components/AccessControl/Permissions.tsx

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

* regenerate i18n

* add doc

---------

Co-authored-by: ievaVasiljeva <ieva.vasiljeva@grafana.com>
2023-10-06 17:48:13 +02:00
Jo
26339f978b
Auth: Move access control API to SignedInUser interface ()
* move access control api to SignedInUser interface

* remove unused code

* add logic for reading perms from a specific org

* move the specific org logic to org_user.go

* add a comment

---------

Co-authored-by: IevaVasiljeva <ieva.vasiljeva@grafana.com>
2023-08-18 11:42:18 +01:00
Ieva
4980b64274
RBAC: Remove legacy ac from authorization middleware ()
remove legacy AC fallback from RBAC middleware, and some unused auth logic
2023-05-24 09:49:42 +01:00
idafurjes
6c5a573772
Chore: Move ReqContext to contexthandler service ()
* Chore: Move ReqContext to contexthandler service

* Rename package to contextmodel

* Generate ngalert files

* Remove unused imports
2023-01-27 08:50:36 +01:00
Karl Persson
6d1bcd9f40
DataSourcePermissions: Handle licensing properly for ds permissions ()
* RBAC: add viewer grand if dspermissions enforcement is not enabled

* RBAC: Change permissions based on role prefix

* RBAC: Add option to for permission service to add a license middleware

* RBAC: Remove actions from query struct
2022-12-02 13:19:14 +01:00
Ieva
2546437e20
add an endpoint for updating several managed permissions with one call () 2022-10-31 11:46:58 +00:00
Karl Persson
cc78486535
RBAC: Display indicator if a permission is inherited ()
* RBAC: Add IsInherited property

* PermissionList: Display inherited indicator
2022-08-23 05:34:19 -04:00
Karl Persson
91ef08de68
RBAC: Remove unused code () 2022-08-12 13:02:24 +02:00
idafurjes
a14621fff6
Chore: Add user service method SetUsingOrg and GetSignedInUserWithCacheCtx ()
* Chore: Add user service method SetUsingOrg

* Chore: Add user service method GetSignedInUserWithCacheCtx

* Use method GetSignedInUserWithCacheCtx from user service

* Fix lint after rebase

* Fix lint

* Fix lint error

* roll back some changes

* Roll back changes in api and middleware

* Add xorm tags to SignedInUser ID fields
2022-08-11 13:28:55 +02:00
idafurjes
6afad51761
Move SignedInUser to user service and RoleType and Roles to org ()
* Move SignedInUser to user service and RoleType and Roles to org

* Use go naming convention for roles

* Fix some imports and leftovers

* Fix ldap debug test

* Fix lint

* Fix lint 2

* Fix lint 3

* Fix type and not needed conversion

* Clean up messages in api tests

* Clean up api tests 2
2022-08-10 11:56:48 +02:00
Ieva
b3a10202d4
Revert "Service accounts: Add service account to teams" ()
* Revert "Service accounts: Add service account to teams ()"

This reverts commit 0f919671e7.

* remove unneeded line

* fix test
2022-07-26 09:43:29 +01:00
Eric Leijonmarck
0f919671e7
Service accounts: Add service account to teams ()
* Revert "Serviceaccounts: 

Do not display service accounts assigned to team ()"

This reverts commit cbf71fbd7f.

* fix: test to not include more actions than necessary

* adding service accounts to teams - backend and frontend changes

* also support SA addition through the old team membership endpoints

* fix tests

* tests

* serviceaccounts permission tests

* serviceaccounts permission service tests run

* added back test that was removed by accident

* lint

* refactor: add testoptionsTeams

* fix a bug

* service account picker change

* explicitly set SA managed permissions to false for dash and folders

* lint

* allow team creator to list service accounts

Co-authored-by: IevaVasiljeva <ieva.vasiljeva@grafana.com>
2022-07-06 05:34:36 -04:00
Karl Persson
9fd9a2cded
RBAC: Remove workaround to check permissions on folders for dashboard actions ()
* remove workaround to check permissions on folders for dashboard actions
2022-06-07 13:21:56 +02:00
Karl Persson
5caf97be40
AccessControl: Replace IsEnterprise checks with license checks () 2022-05-25 20:40:41 +02:00
Karl Persson
61772a66b6
AccessControl: Create own interface and impl for each permission service ()
* Create own interfaces for team, folder, dashboard and data source permissions services
* Remove service container and inject them individually
2022-05-10 15:48:47 +02:00
Karl Persson
c207ea30eb
Access Control: Remove unused option ()
* Remove unused option
2022-04-29 11:05:51 +02:00
Karl Persson
e9a93ebfc9
Access Control: Move access control middlewares to domain package ()
* Move access control middleware to domain package
2022-04-28 10:46:18 +02:00
Jguer
90a94eab74
Dashboard/Folder permission fix session ()
* Fix inherited scopes for dashboard to use folder uid

* Add inherited evaluators

* Slight modification of the commments

* Add test for inheritance

* Nit.

* extract shared function from tests

* Nit. Extra line

* Remove unused comment

Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: gamab <gabi.mabs@gmail.com>
2022-04-05 14:28:23 +02:00
Karl Persson
7ab1ef8d6e
Access Control: Support other attributes than id for resource permissions ()
* Add option to set ResourceAttribute for a permissions service
* Use prefix in access control sql filter to parse scopes
* Use prefix in access control metadata to check access
2022-03-21 17:58:18 +01:00
Karl Persson
4df7bf5ab2
Access control: Display inherited folder permissions in dashboards () 2022-03-17 17:08:51 +01:00
Karl Persson
0debf33c76
Access control: Always append all permissions to role admin in oss ()
* Always append all permissions to built in role admin in oss
2022-03-07 13:28:39 +01:00
Karl Persson
4982ca3b1d
Access control: Use access control for dashboard and folder ()
* Add actions and scopes

* add resource service for dashboard and folder

* Add dashboard guardian with fgac permission evaluation

* Add CanDelete function to guardian interface

* Add CanDelete property to folder and dashboard dto and set values

* change to correct function name

* Add accesscontrol to folder endpoints

* add access control to dashboard endpoints

* check access for nav links

* Add fixed roles for dashboard and folders

* use correct package

* add hack to override guardian Constructor if accesscontrol is enabled

* Add services

* Add function to handle api backward compatability

* Add permissionServices to HttpServer

* Set permission when new dashboard is created

* Add default permission when creating new dashboard

* Set default permission when creating folder and dashboard

* Add access control filter for dashboard search

* Add to accept list

* Add accesscontrol to dashboardimport

* Disable access control in tests

* Add check to see if user is allow to create a dashboard

* Use SetPermissions

* Use function to set several permissions at once

* remove permissions for folder and dashboard on delete

* update required permission

* set permission for provisioning

* Add CanCreate to dashboard guardian and set correct permisisons for
provisioning

* Dont set admin on folder / dashboard creation

* Add dashboard and folder permission migrations

* Add tests for CanCreate

* Add roles and update descriptions

* Solve uid to id for dashboard and folder permissions

* Add folder and dashboard actions to permission filter

* Handle viewer_can_edit flag

* set folder and dashboard permissions services

* Add dashboard permissions when importing a new dashboard

* Set access control permissions on provisioning

* Pass feature flags and only set permissions if access control is enabled

* only add default permissions for folders and dashboards without folders

* Batch create permissions in migrations


* Remove `dashboards:edit` action

* Remove unused function from interface

* Update pkg/services/guardian/accesscontrol_guardian_test.go

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2022-03-03 15:05:47 +01:00
Karl Persson
18cbfba596
Access control: Filter users and teams by read permissions ()
* pass signed in user and filter based on permissions
2022-03-01 10:58:41 +01:00
Karl Persson
d2b9da9dde
Access control: Support uids for resource permissions ()
* add middleware to solve uid -> id for requests
2022-02-10 17:47:48 +01:00
Ieva
602d62ebcc
Access control: FGAC for team sync endpoints ()
* add actions for team group sync

* extend the hook to allow specifying whether the user is external

* move user struct to type package

* interface for permission service to allow mocking it

* reuse existing permissions

* test fix

* refactor

* linting
2022-02-03 15:27:05 +00:00
Karl Persson
de2c5783fa
Access Control: Pass db session to hooks ()
* Move hook calls to database and pass session
2022-01-25 17:12:00 +01:00
ying-jeanne
7422789ec7
Remove Macaron ParamsInt64 function from code base ()
* draft commit

* change all calls

* Compilation errors
2022-01-15 00:55:57 +08:00
Karl Persson
c3ca2d214d
Access control: Refactor managed permission system to create api and frontend components ()
* Refactor resource permissions
* Add frondend components for resource permissions

Co-authored-by: kay delaney <45561153+kaydelaney@users.noreply.github.com>
Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
2021-12-20 09:52:24 +01:00