diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go index a492232a4..213545d83 100644 --- a/internal/rpc/msg/verify.go +++ b/internal/rpc/msg/verify.go @@ -20,6 +20,7 @@ import ( "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" @@ -63,6 +64,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 diff --git a/pkg/authverify/token.go b/pkg/authverify/token.go index f1b377bad..872feb1cf 100644 --- a/pkg/authverify/token.go +++ b/pkg/authverify/token.go @@ -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 +}