Skip to content

Commit

Permalink
RHINENG-11685: add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dugowitch authored and psegedy committed Aug 16, 2024
1 parent a0aaa63 commit 36039a2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions manager/middlewares/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ func isAccessGranted(c *gin.Context) bool {
client := makeClient(c.GetHeader("x-rh-identity"))
access := rbac.AccessPagination{}
res, err := client.Request(&base.Context, http.MethodGet, rbacURL, nil, &access)
if res != nil {
utils.LogDebug("response_headers", res.Header, "request_headers", res.Request.Header, "isAccessGranted rbac")
}
if c.Request != nil {
utils.LogDebug("gin_context_req", *c.Request, "isAccessGranted rbac")
}
if res != nil && res.Body != nil {
defer res.Body.Close()
}
Expand Down Expand Up @@ -195,6 +201,9 @@ func RBAC() gin.HandlerFunc {
if isAccessGranted(c) {
return
}
if c.Request != nil {
utils.LogDebug("context_req", c.Request, "RBAC")
}
c.AbortWithStatusJSON(http.StatusUnauthorized,
utils.ErrorResponse{Error: "You don't have access to this application"})
}
Expand Down

0 comments on commit 36039a2

Please sign in to comment.