Overview

Namespaces

  • Budabot
    • Core
      • Modules
    • User
      • Modules
  • None
  • Tyrence
    • Modules

Classes

  • AccessManager
  • AdminManager
  • AOChat
  • AOChatPacket
  • AOChatQueue
  • AOExtMsg
  • AsyncHttp
  • AutoInject
  • BotRunner
  • Budabot
  • BuddylistManager
  • CacheManager
  • CacheResult
  • ClassLoader
  • ColorSettingHandler
  • CommandAlias
  • CommandManager
  • ConfigFile
  • DB
  • DBRow
  • EventLoop
  • EventManager
  • GuildChannelCommandReply
  • GuildManager
  • HelpManager
  • Http
  • HttpRequest
  • LegacyLogger
  • LimitsController
  • LoggerWrapper
  • MMDBParser
  • NumberSettingHandler
  • OptionsSettingHandler
  • PlayerHistory
  • PlayerHistoryManager
  • PlayerManager
  • Preferences
  • PrivateChannelCommandReply
  • PrivateMessageCommandReply
  • Registry
  • SettingHandler
  • SettingManager
  • SettingObject
  • SocketManager
  • SocketNotifier
  • SubcommandManager
  • Text
  • TextSettingHandler
  • Timer
  • TimerEvent
  • TimeSettingHandler
  • Util
  • xml

Interfaces

  • CommandReply

Exceptions

  • InvalidHttpRequest
  • SQLException
  • StopExecutionException

Functions

  • isWindows
  • Overview
  • Namespace
  • Class

Class AccessManager

The AccessLevel class provides functionality for checking a player's access level.

Namespace: Budabot\Core
Instance
Located at AccessManager.class.php
Methods summary
public boolean
# checkAccess( string $sender, string $accessLevel )

This method checks if given $sender has at least $accessLevel rights.

This method checks if given $sender has at least $accessLevel rights.

Normally, you don't have to worry about access levels in the bot. The bot will automatically restrict access to commands based on the access level setting on the command and the access level of the user trying to access the command.

However, there are some cases where you may need this functionality. For instance, you may have a command that displays the names of the last ten people to send a tell to the bot. You may wish to display a "ban" link when a moderator or higher uses that command.

To check if a character named 'Tyrence' has moderator access, you would do:

if ($this->accessManager->checkAccess("Tyrence", "moderator")) {
   // Tyrence has [at least] moderator access level
} else {
   // Tyrence does not have moderator access level
}

Note that this will return true if 'Tyrence' is a moderator on your bot, but also if he is anything higher, such as administrator, or superadmin.

This command will check the character's "effective" access level, meaning the higher of it's own access level and that of it's main, if it has a main and if it has been validated as an alt.

Parameters

$sender
  • the name of the person you want to check access on
$accessLevel
  • can be one of: superadmin, admininistrator, moderator, guild, member, raidleader, all

Returns

boolean
true if $sender has at least $accessLevel, false otherwise
public
# checkSingleAccess( $sender, $accessLevel )
public
# getDisplayName( $accessLevel )
public
# getSingleAccessLevel( $sender )

Returns the access level of $sender, ignoring guild admin and inheriting access level from main

Returns the access level of $sender, ignoring guild admin and inheriting access level from main

public
# getAccessLevelForCharacter( $sender )

Returns the access level of $sender, accounting for guild admin and inheriting access level from main

Returns the access level of $sender, accounting for guild admin and inheriting access level from main

public
# compareAccessLevels( $accessLevel1, $accessLevel2 )

Returns a positive number if $accessLevel1 is a greater access level than $accessLevel2, a negative number if $accessLevel1 is a lesser access level than $accessLevel2, and 0 if the access levels are equal.

Returns a positive number if $accessLevel1 is a greater access level than $accessLevel2, a negative number if $accessLevel1 is a lesser access level than $accessLevel2, and 0 if the access levels are equal.

public
# compareCharacterAccessLevels( $char1, $char2 )

Returns a positive number if the access level of $char1 is greater than the access level of $char2, a negative number if the access level of $char1 is less than the access level of $char2, and 0 if the access levels of $char1 and $char2 are equal.

Returns a positive number if the access level of $char1 is greater than the access level of $char2, a negative number if the access level of $char1 is less than the access level of $char2, and 0 if the access levels of $char1 and $char2 are equal.

public
# getAccessLevel( $accessLevel )
public
# getAccessLevels( )
Properties summary
private static array $ACCESS_LEVELS
# array('none' => 0, 'superadmin' => 1, 'admin' => 2, 'mod' => 3, 'guild' => 4, 'member' => 5, 'rl' => 6, 'all' => 7)
public $db

Inject

#
public $setting

Inject

#
public $chatBot

Inject

#
public $adminManager

Inject

#
public $logger

Logger

#
public $altsController

Inject

#
public $chatLeaderController

Inject

#
Budabot 4 Docs API documentation generated by ApiGen