This commit is contained in:
wangchuxiao 2023-03-16 12:00:14 +08:00
parent 642743957e
commit a8dd306196
3 changed files with 4 additions and 4 deletions

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/OpenIMSDK/Open-IM-Server
go 1.16
go 1.18
require (
firebase.google.com/go v3.13.0+incompatible

View File

@ -75,7 +75,6 @@ func (s *friendServer) ApplyToAddFriend(ctx context.Context, req *pbfriend.Apply
// ok
func (s *friendServer) ImportFriends(ctx context.Context, req *pbfriend.ImportFriendReq) (resp *pbfriend.ImportFriendResp, err error) {
resp = &pbfriend.ImportFriendResp{}
if err := tokenverify.CheckAdmin(ctx); err != nil {
return nil, err
}
@ -93,7 +92,7 @@ func (s *friendServer) ImportFriends(ctx context.Context, req *pbfriend.ImportFr
if err := s.FriendDatabase.BecomeFriends(ctx, req.OwnerUserID, req.FriendUserIDs, constant.BecomeFriendByImport); err != nil {
return nil, err
}
return resp, nil
return &pbfriend.ImportFriendResp{}, nil
}
// ok

View File

@ -2,6 +2,7 @@ package tokenverify
import (
"context"
"fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tracelog"
"github.com/OpenIMSDK/Open-IM-Server/pkg/errs"
@ -78,7 +79,7 @@ func CheckAdmin(ctx context.Context) error {
if utils.IsContain(tracelog.GetOpUserID(ctx), config.Config.Manager.AppManagerUid) {
return nil
}
return errs.ErrIdentity.Wrap("operate user is not admin")
return errs.ErrIdentity.Wrap(fmt.Sprintf("user %s is not admin userID", tracelog.GetOpUserID(ctx)))
}
func ParseRedisInterfaceToken(redisToken interface{}) (*Claims, error) {