mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	用户可以查看访问日志
This commit is contained in:
		@@ -10,6 +10,11 @@ var (
 | 
				
			|||||||
			Code:        "server.accessLog",
 | 
								Code:        "server.accessLog",
 | 
				
			||||||
			Description: "用户可以开启服务的访问日志",
 | 
								Description: "用户可以开启服务的访问日志",
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Name:        "查看访问日志",
 | 
				
			||||||
 | 
								Code:        "server.viewAccessLog",
 | 
				
			||||||
 | 
								Description: "用户可以查看服务的访问日志",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Name:        "转发访问日志",
 | 
								Name:        "转发访问日志",
 | 
				
			||||||
			Code:        "server.accessLog.forward",
 | 
								Code:        "server.accessLog.forward",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -81,7 +81,7 @@ func (this *HTTPAccessLogService) ListHTTPAccessLogs(ctx context.Context, req *p
 | 
				
			|||||||
// 查找单个日志
 | 
					// 查找单个日志
 | 
				
			||||||
func (this *HTTPAccessLogService) FindHTTPAccessLog(ctx context.Context, req *pb.FindHTTPAccessLogRequest) (*pb.FindHTTPAccessLogResponse, error) {
 | 
					func (this *HTTPAccessLogService) FindHTTPAccessLog(ctx context.Context, req *pb.FindHTTPAccessLogRequest) (*pb.FindHTTPAccessLogResponse, error) {
 | 
				
			||||||
	// 校验请求
 | 
						// 校验请求
 | 
				
			||||||
	_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
 | 
						_, userId, err := this.ValidateAdminAndUser(ctx, 0, 0)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -95,6 +95,15 @@ func (this *HTTPAccessLogService) FindHTTPAccessLog(ctx context.Context, req *pb
 | 
				
			|||||||
	if accessLog == nil {
 | 
						if accessLog == nil {
 | 
				
			||||||
		return &pb.FindHTTPAccessLogResponse{AccessLog: nil}, nil
 | 
							return &pb.FindHTTPAccessLogResponse{AccessLog: nil}, nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 检查权限
 | 
				
			||||||
 | 
						if userId > 0 {
 | 
				
			||||||
 | 
							err = models.SharedServerDAO.CheckUserServer(tx, int64(accessLog.ServerId), userId)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								return nil, err
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	a, err := accessLog.ToPB()
 | 
						a, err := accessLog.ToPB()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -177,7 +177,7 @@ func (this *IPLibraryService) DeleteIPLibrary(ctx context.Context, req *pb.Delet
 | 
				
			|||||||
// 查询某个IP信息
 | 
					// 查询某个IP信息
 | 
				
			||||||
func (this *IPLibraryService) LookupIPRegion(ctx context.Context, req *pb.LookupIPRegionRequest) (*pb.LookupIPRegionResponse, error) {
 | 
					func (this *IPLibraryService) LookupIPRegion(ctx context.Context, req *pb.LookupIPRegionRequest) (*pb.LookupIPRegionResponse, error) {
 | 
				
			||||||
	// 校验请求
 | 
						// 校验请求
 | 
				
			||||||
	_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
 | 
						_, _, err := this.ValidateAdminAndUser(ctx, 0, 0)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -217,7 +217,7 @@ func (this *IPLibraryService) LookupIPRegion(ctx context.Context, req *pb.Lookup
 | 
				
			|||||||
// 查询一组IP信息
 | 
					// 查询一组IP信息
 | 
				
			||||||
func (this *IPLibraryService) LookupIPRegions(ctx context.Context, req *pb.LookupIPRegionsRequest) (*pb.LookupIPRegionsResponse, error) {
 | 
					func (this *IPLibraryService) LookupIPRegions(ctx context.Context, req *pb.LookupIPRegionsRequest) (*pb.LookupIPRegionsResponse, error) {
 | 
				
			||||||
	// 校验请求
 | 
						// 校验请求
 | 
				
			||||||
	_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
 | 
						_, _, err := this.ValidateAdminAndUser(ctx, 0, 0)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user