AccessLevel - jimdroberts/FishMMO GitHub Wiki
Enum representing user access levels and permissions in the game. Used for authentication, moderation, and feature gating.
-
Banned = 0
User is banned and cannot access the game.
-
Player
Regular player with standard permissions.
-
Guide
Guide or helper with limited support permissions.
-
GameMaster
Game master with advanced moderation and support permissions.
-
Administrator
Administrator with full permissions and access to all features.
- Use
AccessLevel
to represent and check user permissions throughout the game. - Assign appropriate access levels to users based on their roles.
// Example 1: Checking access level
if (user.AccessLevel == AccessLevel.Administrator) {
// Grant admin privileges
}
// Example 2: Restricting banned users
if (user.AccessLevel == AccessLevel.Banned) {
// Deny access
}
- Use clear, descriptive names for each access level to avoid confusion.
- Always check access levels before granting permissions or features.
- Document any changes to access level logic for maintainability.
- Use enums for type safety and clarity in permission checks.