MCPcopy Create free account
hub / github.com/bytebase/bytebase / hasAllowMissingEnabled

Function hasAllowMissingEnabled

backend/api/v1/acl.go:90–112  ·  view source on GitHub ↗

hasAllowMissingEnabled checks if the request has allow_missing field set to true. Uses proto reflection to handle different request types generically.

(request any)

Source from the content-addressed store, hash-verified

88// hasAllowMissingEnabled checks if the request has allow_missing field set to true.
89// Uses proto reflection to handle different request types generically.
90func hasAllowMissingEnabled(request any) bool {
91 if request == nil {
92 return false
93 }
94
95 pm, ok := request.(proto.Message)
96 if !ok {
97 return false
98 }
99
100 mr := pm.ProtoReflect()
101 fd := mr.Descriptor().Fields().ByName("allow_missing")
102 if fd == nil {
103 return false
104 }
105
106 // Check if field is a bool and get its value
107 if fd.Kind() != protoreflect.BoolKind {
108 return false
109 }
110
111 return mr.Get(fd).Bool()
112}
113
114func (in *ACLInterceptor) doACLCheck(ctx context.Context, request any, fullMethod string) error {
115 defer func() {

Callers 2

doACLCheckMethod · 0.85

Calls 3

GetMethod · 0.80
ProtoReflectMethod · 0.45
DescriptorMethod · 0.45

Tested by 1