RBAC: Fix delete team permissions on team delete (#83442)

* RBAC: Remove team permissions on delete

* Remove unecessary deletes from store function

* Nit on mock

* Add test to the database

* Nit on comment

* Add another test to check that other permissions remain
This commit is contained in:
Gabriel MABILLE
2024-02-27 12:21:26 +01:00
committed by GitHub
parent ffae7d111c
commit 8d9921a5ba
9 changed files with 178 additions and 5 deletions
+6
View File
@@ -127,6 +127,12 @@ func (tapi *TeamAPI) deleteTeamByID(c *contextmodel.ReqContext) response.Respons
}
return response.Error(http.StatusInternalServerError, "Failed to delete Team", err)
}
// Clear associated team assignments, managed role and permissions
if err := tapi.ac.DeleteTeamPermissions(c.Req.Context(), orgID, teamID); err != nil {
return response.Error(http.StatusInternalServerError, "Failed to delete Team permissions", err)
}
return response.Success("Team deleted")
}