fix version 1
This commit is contained in:
@@ -16,7 +16,7 @@ import (
|
||||
// 获取一条地址
|
||||
func Get(ctx context.Context, in *pb.IdentRequest) (reply *pb.AddressItem, err error) {
|
||||
// parse authorization meta.
|
||||
_, err = service.ParseMetaCtx(ctx, nil)
|
||||
auth, err := service.ParseMetaCtx(ctx, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -26,7 +26,8 @@ func Get(ctx context.Context, in *pb.IdentRequest) (reply *pb.AddressItem, err e
|
||||
}
|
||||
|
||||
address := new(models.AddressLibrary)
|
||||
err = impl.DBService.Where("id=?", in.Id).First(&address).Error
|
||||
// 查询必须限定归属,避免越权读取他人地址
|
||||
err = impl.DBService.Where("id=? and owner_identity=?", in.Id, auth.Identity).First(&address).Error
|
||||
|
||||
if err != nil {
|
||||
if errors.Is(err, models.ErrNotFound) {
|
||||
|
||||
Reference in New Issue
Block a user