diff --git a/deployments/templates/config.yaml b/deployments/templates/config.yaml index 82f76597c..cc318adcd 100644 --- a/deployments/templates/config.yaml +++ b/deployments/templates/config.yaml @@ -243,9 +243,10 @@ push: # # Built-in app manager user IDs # Built-in app manager nicknames +# Attention, this configure is discarded. If you have used him before, configure your own manager: - userID: [ "${MANAGER_USERID_1}", "${MANAGER_USERID_2}", "${MANAGER_USERID_3}" ] - nickname: [ "${NICKNAME_1}", "${NICKNAME_2}", "${NICKNAME_3}" ] + userID: + nickname: # chatAdmin, use for send notification # @@ -329,7 +330,7 @@ callback: timeout: ${CALLBACK_TIMEOUT} failedContinue: ${CALLBACK_FAILED_CONTINUE} afterSendSingleMsg: - enable: true + enable: ${CALLBACK_ENABLE} timeout: ${CALLBACK_TIMEOUT} failedContinue: ${CALLBACK_FAILED_CONTINUE} beforeSendGroupMsg: diff --git a/docs/contrib/environment.md b/docs/contrib/environment.md index 366a1d94f..fb696eb54 100644 --- a/docs/contrib/environment.md +++ b/docs/contrib/environment.md @@ -477,12 +477,6 @@ This section involves setting up additional configuration variables for Websocke | JPNS_MASTER_SECRET | [User Defined] | JPNS Master Secret | | JPNS_PUSH_URL | [User Defined] | JPNS Push Notification URL | | JPNS_PUSH_INTENT | [User Defined] | JPNS Push Intent | -| MANAGER_USERID_1 | "openIM123456" | Administrator ID 1 | -| MANAGER_USERID_2 | "openIM654321" | Administrator ID 2 | -| MANAGER_USERID_3 | "openIMAdmin" | Administrator ID 3 | -| NICKNAME_1 | "system1" | Nickname 1 | -| NICKNAME_2 | "system2" | Nickname 2 | -| NICKNAME_3 | "system3" | Nickname 3 | | IM_ADMIN_USERID | "imAdmin" | IM Administrator ID | | IM_ADMIN_NAME | "imAdmin" | IM Administrator Nickname | | MULTILOGIN_POLICY | "1" | Multi-login Policy | diff --git a/internal/push/push_to_client.go b/internal/push/push_to_client.go index 72deb720d..6cf3f558b 100644 --- a/internal/push/push_to_client.go +++ b/internal/push/push_to_client.go @@ -231,6 +231,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) diff --git a/internal/rpc/msg/revoke.go b/internal/rpc/msg/revoke.go index d7362d339..91ded4827 100644 --- a/internal/rpc/msg/revoke.go +++ b/internal/rpc/msg/revoke.go @@ -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 { + 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 { diff --git a/internal/rpc/msg/verify.go b/internal/rpc/msg/verify.go index 2837cb944..4768fe1c5 100644 --- a/internal/rpc/msg/verify.go +++ b/internal/rpc/msg/verify.go @@ -54,6 +54,9 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe if 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 && data.MsgData.ContentType >= constant.NotificationBegin { return nil @@ -91,6 +94,9 @@ func (m *msgServer) messageVerification(ctx context.Context, data *msg.SendMsgRe if 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 && data.MsgData.ContentType >= constant.NotificationBegin { return nil diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 50c97f41b..a2bda5bc6 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -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)") } diff --git a/scripts/install/environment.sh b/scripts/install/environment.sh index aeb4fcc36..b1d2354b9 100755 --- a/scripts/install/environment.sh +++ b/scripts/install/environment.sh @@ -349,12 +349,6 @@ def "JPNS_APP_KEY" "" # JPNS应用密钥 def "JPNS_MASTER_SECRET" "" # JPNS主密钥 def "JPNS_PUSH_URL" "" # JPNS推送URL def "JPNS_PUSH_INTENT" "" # JPNS推送意图 -def "MANAGER_USERID_1" "openIM123456" # 管理员ID 1 -def "MANAGER_USERID_2" "openIM654321" # 管理员ID 2 -def "MANAGER_USERID_3" "openIMAdmin" # 管理员ID 3 -def "NICKNAME_1" "system1" # 昵称1 -def "NICKNAME_2" "system2" # 昵称2 -def "NICKNAME_3" "system3" # 昵称3 def "IM_ADMIN_USERID" "imAdmin" # IM管理员ID def "IM_ADMIN_NAME" "imAdmin" # IM管理员昵称 def "MULTILOGIN_POLICY" "1" # 多登录策略