Access control: Using RBAC to filter users in list view that you have read access to (#47963)

* Add SQL filter for global user search

* Remove scope requirements from endpoints

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
This commit is contained in:
Eric Leijonmarck
2022-05-13 09:26:34 +02:00
committed by GitHub
parent a51c2774b8
commit 555867135b
6 changed files with 57 additions and 11 deletions

View File

@@ -61,7 +61,14 @@ func (s *OSSService) SearchUser(c *models.ReqContext) (*models.SearchUsersQuery,
}
}
query := &models.SearchUsersQuery{Query: searchQuery, Filters: filters, Page: page, Limit: perPage}
query := &models.SearchUsersQuery{
// added SignedInUser to the query, as to only list the users that the user has permission to read
SignedInUser: c.SignedInUser,
Query: searchQuery,
Filters: filters,
Page: page,
Limit: perPage,
}
if err := s.sqlStore.SearchUsers(c.Req.Context(), query); err != nil {
return nil, err
}