Access control: Fix listing data sources for org admins (#48961)

* Access control: Fix listing data sources for org admins

* Access control: always list non-core plugins for org admins
This commit is contained in:
Alexander Zobnin 2022-05-13 15:07:08 +03:00 committed by GitHub
parent 75760e90b4
commit 4cd1a113ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,7 @@ func (hs *HTTPServer) GetPluginList(c *models.ReqContext) response.Response {
// When using access control anyone that can create a data source should be able to list all data sources installed
// Fallback to only letting admins list non-core plugins
hasAccess := accesscontrol.HasAccess(hs.AccessControl, c)
if !hasAccess(accesscontrol.ReqOrgAdmin, accesscontrol.EvalPermission(datasources.ActionCreate)) || c.HasRole(models.ROLE_ADMIN) {
if !hasAccess(accesscontrol.ReqOrgAdmin, accesscontrol.EvalPermission(datasources.ActionCreate)) && !c.HasRole(models.ROLE_ADMIN) {
coreFilter = "1"
}