fix: add extra check for code intelligence inference (#64083)

This commit is contained in:
Vincent 2024-07-26 15:22:52 +01:00 committed by GitHub
parent d249b8f701
commit 2333ddeaab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,10 @@ import (
)
func (r *rootResolver) CodeIntelligenceInferenceScript(ctx context.Context) (script string, err error) {
if err := r.siteAdminChecker.CheckCurrentUserIsSiteAdmin(ctx); err != nil {
return "", err
}
ctx, _, endObservation := r.operations.codeIntelligenceInferenceScript.With(ctx, &err, observation.Args{})
defer endObservation(1, observation.Args{})
@ -17,6 +21,10 @@ func (r *rootResolver) CodeIntelligenceInferenceScript(ctx context.Context) (scr
}
func (r *rootResolver) UpdateCodeIntelligenceInferenceScript(ctx context.Context, args *resolverstubs.UpdateCodeIntelligenceInferenceScriptArgs) (_ *resolverstubs.EmptyResponse, err error) {
if err := r.siteAdminChecker.CheckCurrentUserIsSiteAdmin(ctx); err != nil {
return nil, err
}
ctx, _, endObservation := r.operations.updateCodeIntelligenceInferenceScript.With(ctx, &err, observation.Args{Attrs: []attribute.KeyValue{
attribute.String("script", args.Script),
}})