hasAllowMissingEnabled checks if the request has allow_missing field set to true. Uses proto reflection to handle different request types generically.
(request any)
| 88 | // hasAllowMissingEnabled checks if the request has allow_missing field set to true. |
| 89 | // Uses proto reflection to handle different request types generically. |
| 90 | func 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 | |
| 114 | func (in *ACLInterceptor) doACLCheck(ctx context.Context, request any, fullMethod string) error { |
| 115 | defer func() { |