mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-07 11:40:01 +08:00
feat: system account send msg doesn't need friend verify (#3187)
This commit is contained in:
parent
8342f97349
commit
a66312dabe
@ -16,6 +16,11 @@ package msg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/servererrs"
|
||||
"github.com/openimsdk/tools/utils/datautil"
|
||||
"github.com/openimsdk/tools/utils/encrypt"
|
||||
@ -62,6 +67,13 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe
|
||||
if err := m.webhookBeforeSendSingleMsg(ctx, &m.config.WebhooksConfig.BeforeSendSingleMsg, data); err != nil {
|
||||
return err
|
||||
}
|
||||
u, err := m.UserLocalCache.GetUserInfo(ctx, data.MsgData.SendID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if authverify.CheckSystemAccount(ctx, u.AppMangerLevel) {
|
||||
return nil
|
||||
}
|
||||
black, err := m.FriendLocalCache.IsBlack(ctx, data.MsgData.SendID, data.MsgData.RecvID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/common/servererrs"
|
||||
"github.com/openimsdk/protocol/constant"
|
||||
"github.com/openimsdk/tools/mcontext"
|
||||
"github.com/openimsdk/tools/utils/datautil"
|
||||
)
|
||||
@ -55,3 +56,7 @@ func CheckAdmin(ctx context.Context, imAdminUserID []string) error {
|
||||
func IsManagerUserID(opUserID string, imAdminUserID []string) bool {
|
||||
return datautil.Contain(opUserID, imAdminUserID...)
|
||||
}
|
||||
|
||||
func CheckSystemAccount(ctx context.Context, level int32) bool {
|
||||
return level >= constant.AppAdmin
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user