chore: Update rego to be partial execution friendly (#3449)

- Improves performance of batch authorization calls
- Enables possibility to convert rego auth calls into SQL WHERE clauses
This commit is contained in:
Steven Masley
2022-08-11 22:07:48 +00:00
committed by GitHub
parent 4a17e0d91f
commit 3ae42f4de9
16 changed files with 1131 additions and 825 deletions
+8 -1
View File
@@ -145,7 +145,14 @@ func (api *API) workspaces(rw http.ResponseWriter, r *http.Request) {
}
// Only return workspaces the user can read
workspaces = AuthorizeFilter(api, r, rbac.ActionRead, workspaces)
workspaces, err = AuthorizeFilter(api, r, rbac.ActionRead, workspaces)
if err != nil {
httpapi.Write(rw, http.StatusInternalServerError, codersdk.Response{
Message: "Internal error fetching workspaces.",
Detail: err.Error(),
})
return
}
apiWorkspaces, err := convertWorkspaces(r.Context(), api.Database, workspaces)
if err != nil {