Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Token and credentials as inputs on unlink operations are now optional. - Improve runtime IAP operation errors to include provider payload in error message. - Build with Go 1.19.2 release. - Disconnect users when they are banned from the console or runtime functions. ### Fixed - Observe the error if returned in storage list errors in JavaScript runtime. Loading server/console_account.go +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ func (s *ConsoleServer) BanAccount(ctx context.Context, in *console.AccountId) ( return nil, status.Error(codes.InvalidArgument, "Cannot ban the system user.") } if err := BanUsers(ctx, s.logger, s.db, s.sessionCache, []uuid.UUID{userID}); err != nil { if err := BanUsers(ctx, s.logger, s.db, s.config, s.sessionCache, s.sessionRegistry, s.tracker, []uuid.UUID{userID}); err != nil { // Error logged in the core function above. return nil, status.Error(codes.Internal, "An error occurred while trying to ban the user.") } Loading server/core_account.go +1 −1 Original line number Diff line number Diff line Loading @@ -524,7 +524,7 @@ func DeleteAccount(ctx context.Context, logger *zap.Logger, db *sql.DB, config C return err } for _, presence := range tracker.ListPresenceIDByStream(PresenceStream{Mode: StreamModeNotifications, Subject: userID}) { if err = sessionRegistry.Disconnect(ctx, presence.SessionID); err != nil { if err = sessionRegistry.Disconnect(ctx, presence.SessionID, false); err != nil { return err } } Loading server/core_notification.go +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ const ( NotificationCodeGroupJoinRequest int32 = -5 NotificationCodeFriendJoinGame int32 = -6 NotificationCodeSingleSocket int32 = -7 NotificationCodeUserBanned int32 = -8 ) type notificationCacheableCursor struct { Loading server/core_user.go +10 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ func DeleteUser(ctx context.Context, tx *sql.Tx, userID uuid.UUID) (int64, error return res.RowsAffected() } func BanUsers(ctx context.Context, logger *zap.Logger, db *sql.DB, sessionCache SessionCache, ids []uuid.UUID) error { func BanUsers(ctx context.Context, logger *zap.Logger, db *sql.DB, config Config, sessionCache SessionCache, sessionRegistry SessionRegistry, tracker Tracker, ids []uuid.UUID) error { statements := make([]string, 0, len(ids)) params := make([]interface{}, 0, len(ids)) for i, id := range ids { Loading @@ -196,6 +196,15 @@ func BanUsers(ctx context.Context, logger *zap.Logger, db *sql.DB, sessionCache sessionCache.Ban(ids) for _, id := range ids { // Disconnect. for _, presence := range tracker.ListPresenceIDByStream(PresenceStream{Mode: StreamModeNotifications, Subject: id}) { if err = sessionRegistry.Disconnect(ctx, presence.SessionID, true); err != nil { return err } } } return nil } Loading Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Token and credentials as inputs on unlink operations are now optional. - Improve runtime IAP operation errors to include provider payload in error message. - Build with Go 1.19.2 release. - Disconnect users when they are banned from the console or runtime functions. ### Fixed - Observe the error if returned in storage list errors in JavaScript runtime. Loading
server/console_account.go +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ func (s *ConsoleServer) BanAccount(ctx context.Context, in *console.AccountId) ( return nil, status.Error(codes.InvalidArgument, "Cannot ban the system user.") } if err := BanUsers(ctx, s.logger, s.db, s.sessionCache, []uuid.UUID{userID}); err != nil { if err := BanUsers(ctx, s.logger, s.db, s.config, s.sessionCache, s.sessionRegistry, s.tracker, []uuid.UUID{userID}); err != nil { // Error logged in the core function above. return nil, status.Error(codes.Internal, "An error occurred while trying to ban the user.") } Loading
server/core_account.go +1 −1 Original line number Diff line number Diff line Loading @@ -524,7 +524,7 @@ func DeleteAccount(ctx context.Context, logger *zap.Logger, db *sql.DB, config C return err } for _, presence := range tracker.ListPresenceIDByStream(PresenceStream{Mode: StreamModeNotifications, Subject: userID}) { if err = sessionRegistry.Disconnect(ctx, presence.SessionID); err != nil { if err = sessionRegistry.Disconnect(ctx, presence.SessionID, false); err != nil { return err } } Loading
server/core_notification.go +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ const ( NotificationCodeGroupJoinRequest int32 = -5 NotificationCodeFriendJoinGame int32 = -6 NotificationCodeSingleSocket int32 = -7 NotificationCodeUserBanned int32 = -8 ) type notificationCacheableCursor struct { Loading
server/core_user.go +10 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ func DeleteUser(ctx context.Context, tx *sql.Tx, userID uuid.UUID) (int64, error return res.RowsAffected() } func BanUsers(ctx context.Context, logger *zap.Logger, db *sql.DB, sessionCache SessionCache, ids []uuid.UUID) error { func BanUsers(ctx context.Context, logger *zap.Logger, db *sql.DB, config Config, sessionCache SessionCache, sessionRegistry SessionRegistry, tracker Tracker, ids []uuid.UUID) error { statements := make([]string, 0, len(ids)) params := make([]interface{}, 0, len(ids)) for i, id := range ids { Loading @@ -196,6 +196,15 @@ func BanUsers(ctx context.Context, logger *zap.Logger, db *sql.DB, sessionCache sessionCache.Ban(ids) for _, id := range ids { // Disconnect. for _, presence := range tracker.ListPresenceIDByStream(PresenceStream{Mode: StreamModeNotifications, Subject: id}) { if err = sessionRegistry.Disconnect(ctx, presence.SessionID, true); err != nil { return err } } } return nil } Loading