Bans #

You can restrict a player from logging into your game by issuing a ban on their account. Bans prevent the player from receiving a game authentication token.

Pragma Engine offers the following ban features:

Operators can add, view, and revoke bans on an account using the Social Operator Portal. For more details, see the Social Operator Portal page.

Ban an account #

The following Operator, Partner, and Service endpoints are available to ban an account:

  • AccountRpc.BanAccountOperatorV1Request
  • AccountRpc.BanAccountPartnerV1Request
  • AccountRpc.BanAccountServiceV1Request

Ban an account from all game servers using the SDK:

Server->Session()->BansApi().BanAccountFromGameShard(
  SocialId, 
  AllGames, 
  Delegate
);
server.BansApi.BanAccountFromGameShard(
  socialId, 
  allGames, 
  completeDelegate
);
{
  "requestId": 1,
  "type": "AccountRpc.BanAccountPartnerV1Request",
  "payload": {
      "pragmaSocialId": "d861f6e8-b63d-4582-a6c4-d515b2d8adbb"
  }
}

You can ban a player from a specific game shard. By default, allGames is set to true and issuing a ban will restrict a player from all game shards. When you set allGames to false, this will restrict the player only from the current game shard they’re connected to; the banned account will still receive a gameToken when authenticating for all other game shards.

Once an account has been issued a ban, a currently connected player will receive a notification. The content of this message can be found in AccountRpc.BanV1Notification.

This does not currently end the player’s connected session nor invalidate their still-valid authentication token.

The player game client can listen to the ban notification using the SDK:

Player->Session()->BansApi().OnAccountBanned.AddLambda(
    [this](const FPragmaBan& Ban) {
        // handle ban event
    });
player.BansApi.OnAccountBanned += ban =>
{
    // handle ban event
};

View an account’s ban history #

The following Operator, Partner, and Service endpoints are available to view an account’s ban history:

  • AccountRpc.GetBansBySocialIdOperatorV1Request
  • AccountRpc.GetBansBySocialIdPartnerV1Request
  • AccountRpc.GetBansBySocialIdServiceV1Request

Retrieve an account’s ban history:

{
    "requestId": 1,
    "type": "AccountRpc.GetBansBySocialIdPartnerV1Request",
    "payload": {
        "pragmaSocialId": "d861f6e8-b63d-4582-a6c4-d515b2d8adbb"
    }
}

Below is a sample response:

{
    "banRecords": [
        {
            "banId": "92de04d0-1ddb-4a53-9178-88307a998a73",
            "pragmaSocialId": "d861f6e8-b63d-4582-a6c4-d515b2d8adbb",
            "revoked": false,
            "startTimestampMillis": "1709856971002"
        }
    ]
}

Show a player their account’s ban history:

Player->Session()->BansApi().GetBans(Delegate);
Player.BansApi.GetBans();

Revoke a ban #

The following Operator, Partner, and Service endpoints are available to revoke a ban:

  • AccountRpc.RevokeBanAccountOperatorV1Request
  • AccountRpc.RevokeBanAccountPartnerV1Request
  • AccountRpc.RevokeBanAccountServiceV1Request