Skip to content

Commit 7591ee6

Browse files
authored
Merge pull request #9 from platform-mesh/feat/fix-cluster-level-parent-resolution
fix(handler): improve error logging and object formatting
2 parents f096b3d + e0c5ee9 commit 7591ee6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/handler/handler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ func (a *AuthorizationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
116116
return
117117
}
118118

119+
log.Debug().Str("sar", fmt.Sprintf("%+v", sar)).Msg("Received SubjectAccessReview")
120+
119121
// For resource attributes, we need to get the store ID
120122
accountInfo, err := a.getAccountInfo(r.Context(), sar)
121123
if err != nil {
122-
log.Error().Err(err).Str("user", sar.Spec.User).Msg("error getting store ID from account info")
124+
log.Error().Err(err).Str("user", sar.Spec.User).Msg("error getting store ID from account info, responding with no opinion")
123125
noOpinion(w, sar)
124126
return
125127
}
@@ -206,7 +208,7 @@ func (a *AuthorizationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
206208
User: fmt.Sprintf("core_platform-mesh_io_account:%s/%s", accountInfo.Spec.Account.OriginClusterId, accountInfo.Spec.Account.Name),
207209
})
208210
} else {
209-
object = fmt.Sprintf("%s_%s:%s/%s", groupForType, resourceType, accountInfo.Spec.Account.OriginClusterId, accountInfo.Spec.Account.Name)
211+
object = fmt.Sprintf("core_platform-mesh_io_account:%s/%s", accountInfo.Spec.Account.OriginClusterId, accountInfo.Spec.Account.Name)
210212
}
211213
} else {
212214
object = fmt.Sprintf("%s:%s/%s", objectType, clusterName, objectName)

0 commit comments

Comments
 (0)