AccountData - jimdroberts/FishMMO GitHub Wiki
AccountData
stores account-level information for a user on the server in FishMMO, including access permissions and SRP authentication data.
-
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.
-
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.
- Create a new
AccountData
instance when registering or authenticating a user. - Use the constructor to assign access level and SRP authentication data.
- Access the
AccessLevel
andSrpData
properties as needed for permission checks and authentication.
// 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
}
- 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.