Access Control: Clear user's permission cache after resource creation (#59318)

resolve merge conflicts
This commit is contained in:
Ieva
2022-11-24 18:10:56 +01:00
committed by GitHub
parent c89876323c
commit 6b64e4d192
15 changed files with 100 additions and 32 deletions
+6
View File
@@ -396,6 +396,12 @@ func (hs *HTTPServer) AddDataSource(c *models.ReqContext) response.Response {
return response.Error(500, "Failed to add datasource", err)
}
// Clear permission cache for the user who's created the data source, so that new permissions are fetched for their next call
// Required for cases when caller wants to immediately interact with the newly created object
if !hs.AccessControl.IsDisabled() {
hs.accesscontrolService.ClearUserPermissionCache(c.SignedInUser)
}
ds := hs.convertModelToDtos(c.Req.Context(), cmd.Result)
return response.JSON(http.StatusOK, util.DynMap{
"message": "Datasource added",