允许用户调用获取缓存策略信息API

This commit is contained in:
GoEdgeLab
2023-08-07 19:55:57 +08:00
parent 1ebf3cbdce
commit d17a7cc4eb

View File

@@ -187,7 +187,7 @@ func (this *HTTPCachePolicyService) FindEnabledHTTPCachePolicyConfig(ctx context
// FindEnabledHTTPCachePolicy 查找单个缓存策略信息 // FindEnabledHTTPCachePolicy 查找单个缓存策略信息
func (this *HTTPCachePolicyService) FindEnabledHTTPCachePolicy(ctx context.Context, req *pb.FindEnabledHTTPCachePolicyRequest) (*pb.FindEnabledHTTPCachePolicyResponse, error) { func (this *HTTPCachePolicyService) FindEnabledHTTPCachePolicy(ctx context.Context, req *pb.FindEnabledHTTPCachePolicyRequest) (*pb.FindEnabledHTTPCachePolicyResponse, error) {
_, err := this.ValidateAdmin(ctx) _, _, err := this.ValidateAdminAndUser(ctx, false)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -202,9 +202,10 @@ func (this *HTTPCachePolicyService) FindEnabledHTTPCachePolicy(ctx context.Conte
return &pb.FindEnabledHTTPCachePolicyResponse{HttpCachePolicy: nil}, nil return &pb.FindEnabledHTTPCachePolicyResponse{HttpCachePolicy: nil}, nil
} }
return &pb.FindEnabledHTTPCachePolicyResponse{HttpCachePolicy: &pb.HTTPCachePolicy{ return &pb.FindEnabledHTTPCachePolicyResponse{HttpCachePolicy: &pb.HTTPCachePolicy{
Id: int64(policy.Id), Id: int64(policy.Id),
Name: policy.Name, Name: policy.Name,
IsOn: policy.IsOn, IsOn: policy.IsOn,
MaxBytesJSON: policy.MaxSize,
}}, nil }}, nil
} }