mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 14:29:19 +08:00
feat: del the manager configure and it's initializestatement (#1830)
* fix: del the manager config and manger init statement * fix: fix the Manger judge condition * fix: fix revokeMsg error * fix: find erors * fix: find error * fix: fix the AdminAccount error * fix: del the debug statement
This commit is contained in:
@@ -238,6 +238,9 @@ func (p *Pusher) Push2SuperGroup(ctx context.Context, groupID string, msg *sdkws
|
||||
if len(config.Config.Manager.UserID) > 0 {
|
||||
ctx = mcontext.WithOpUserIDContext(ctx, config.Config.Manager.UserID[0])
|
||||
}
|
||||
if len(config.Config.Manager.UserID) == 0 && len(config.Config.IMAdmin.UserID) > 0 {
|
||||
ctx = mcontext.WithOpUserIDContext(ctx, config.Config.IMAdmin.UserID[0])
|
||||
}
|
||||
defer func(groupID string) {
|
||||
if err = p.groupRpcClient.DismissGroup(ctx, groupID); err != nil {
|
||||
log.ZError(ctx, "DismissGroup Notification clear members", err, "groupID", groupID)
|
||||
|
||||
@@ -111,6 +111,13 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
|
||||
return nil, err
|
||||
}
|
||||
revokerUserID := mcontext.GetOpUserID(ctx)
|
||||
var flag bool
|
||||
if len(config.Config.Manager.UserID) > 0 {
|
||||
flag = utils.Contain(revokerUserID, config.Config.Manager.UserID...)
|
||||
}
|
||||
if len(config.Config.Manager.UserID) == 0 && len(config.Config.IMAdmin.UserID) > 0 {
|
||||
flag = utils.Contain(revokerUserID, config.Config.IMAdmin.UserID...)
|
||||
}
|
||||
tips := sdkws.RevokeMsgTips{
|
||||
RevokerUserID: revokerUserID,
|
||||
ClientMsgID: msgs[0].ClientMsgID,
|
||||
@@ -118,7 +125,7 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
|
||||
Seq: req.Seq,
|
||||
SesstionType: msgs[0].SessionType,
|
||||
ConversationID: req.ConversationID,
|
||||
IsAdminRevoke: utils.Contain(revokerUserID, config.Config.Manager.UserID...),
|
||||
IsAdminRevoke: flag,
|
||||
}
|
||||
var recvID string
|
||||
if msgs[0].SessionType == constant.SuperGroupChatType {
|
||||
|
||||
@@ -51,7 +51,10 @@ type MessageRevoked struct {
|
||||
func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgReq) error {
|
||||
switch data.MsgData.SessionType {
|
||||
case constant.SingleChatType:
|
||||
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.UserID) {
|
||||
if len(config.Config.Manager.UserID) > 0 && utils.IsContain(data.MsgData.SendID, config.Config.Manager.UserID) {
|
||||
return nil
|
||||
}
|
||||
if utils.IsContain(data.MsgData.SendID, config.Config.IMAdmin.UserID) {
|
||||
return nil
|
||||
}
|
||||
if data.MsgData.ContentType <= constant.NotificationEnd &&
|
||||
@@ -88,7 +91,10 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe
|
||||
if groupInfo.GroupType == constant.SuperGroup {
|
||||
return nil
|
||||
}
|
||||
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.UserID) {
|
||||
if len(config.Config.Manager.UserID) > 0 && utils.IsContain(data.MsgData.SendID, config.Config.Manager.UserID) {
|
||||
return nil
|
||||
}
|
||||
if utils.IsContain(data.MsgData.SendID, config.Config.IMAdmin.UserID) {
|
||||
return nil
|
||||
}
|
||||
if data.MsgData.ContentType <= constant.NotificationEnd &&
|
||||
|
||||
@@ -71,12 +71,6 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||
return err
|
||||
}
|
||||
users := make([]*tablerelation.UserModel, 0)
|
||||
if len(config.Config.Manager.UserID) != len(config.Config.Manager.Nickname) {
|
||||
return errors.New("len(config.Config.Manager.AppManagerUid) != len(config.Config.Manager.Nickname)")
|
||||
}
|
||||
for k, v := range config.Config.Manager.UserID {
|
||||
users = append(users, &tablerelation.UserModel{UserID: v, Nickname: config.Config.Manager.Nickname[k], AppMangerLevel: constant.AppAdmin})
|
||||
}
|
||||
if len(config.Config.IMAdmin.UserID) != len(config.Config.IMAdmin.Nickname) {
|
||||
return errors.New("len(config.Config.AppNotificationAdmin.AppManagerUid) != len(config.Config.AppNotificationAdmin.Nickname)")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user