AccountData - jimdroberts/FishMMO GitHub Wiki

Description

AccountData stores account-level information for a user on the server in FishMMO, including access permissions and SRP authentication data.


API Access

Fields

  • public AccessLevel AccessLevel { get; private set; }

    The access level or permissions assigned to the account.

  • public ServerSrpData SrpData { get; private set; }

    The SRP authentication data associated with the account.

Methods

  • public AccountData(AccessLevel accessLevel, ServerSrpData srpData)

    Initializes a new account data instance with the specified access level and SRP data. Parameters: - AccessLevel accessLevel: The access level for the account. - ServerSrpData srpData: The SRP authentication data for the account.


Basic Usage

Setup

  1. Create a new AccountData instance when registering or authenticating a user.
  2. Use the constructor to assign access level and SRP authentication data.
  3. Access the AccessLevel and SrpData properties as needed for permission checks and authentication.

Example

// Example 1: Creating AccountData for a new user
var accountData = new AccountData(AccessLevel.Player, srpData);

// Example 2: Checking access level
if (accountData.AccessLevel == AccessLevel.Admin)
{
    // Grant admin privileges
}

Best Practices

  • Always assign the correct access level when creating account data.
  • Store and manage SRP authentication data securely.
  • Use the AccessLevel property to enforce permission checks throughout the server code.
⚠️ **GitHub.com Fallback** ⚠️