An administrative user

An administrative user is responsible for operation and maintenance of a WHMCS installation. Admins have access to create and manage clients clients, place orders, configure WHMCS, manage modules, and can access all of WHMCS's high level systems. Their accounts can log into the WHMCS client area, and like clients, can be configured to use two-factor authentication modules.

This object models an admin's record in the backend database and contains the admin's information and personal settings.

class Admin extends AbstractUser implements UserInterface

Properties summary

Type Property Description
$unique
int $id An admin's unique id number.
int $roleId ID number of this admin's role. (Role based permissions)
string $username An admin's username.
string $passwordHash An admin's stored password hash.
string $twoFactorAuthModule The name of an admin's two factor authentication module, if they are using one.
string $twoFactorAuthData An admin's two-factor authentication module's internal data, stored as a PHP serialized string.
string $firstName An admin's first name.
string $lastName An admin's last name.
string $email An admin's email address.
string $signature A message displayed at the bottom of an admin's support ticket responses.
string $notes An internal note available for an admin's general use.
string $template The name of the admin area view template WHMCS renders for an admin.
string $language An admin's preferred display language.
int $disabled Whether or not an admin is disabled and cannot log in.
int $loginAttempts The number of times an admin has failed to log into the WHMCS admin area.
array $supportDepartmentIds The id numbers of the support departments an admin is assigned to.
array $receivesTicketNotifications Whether or not an admin receives an email on new support ticket or support ticket reply creation.
string $homeWidgets A comma delimited list of admin area home page widgets and their configuration, separated by colons. For instance, widget_name:true/false
string $passwordResetKey The password reset key for an admin user when requested
string $passwordResetData The password reset data for an admin user when requested
Carbon $passwordResetExpiry The expiry for the password reset key for an admin user
string $fullName An admin's first name and last name.

Methods summary

Return Type Method Name Description
string getFullNameAttribute() "fullName" is the concatenation of first and last name.
string getGravatarHashAttribute() Get gravatar email address hash.
string getUsernameAttribute() Return the username
bool isAllowedToAuthenticate() Should the user be allowed to authenticate
isAllowedToMasquerade() -
bool|mixed|Admin hasPermission(int|string $permission) Has a given permission within their assigned role group

Details

string getFullNameAttribute ()

"fullName" is the concatenation of first and last name.

In classic WHMCS objects, we compute a field named "name" which combines the first and last name for convenience in templates.

Return Value

string The combined name

string getGravatarHashAttribute ()

Get gravatar email address hash.

Return Value

string

string getUsernameAttribute ()

Return the username

This method is required by the UserInterface. tbladmins has a username column, and thus a $username property, however, this model method will prevent the normal model access to that, so the method must manual fetch the value from the internal attributes property. Otherwise a NOTICE will be emitted.

Return Value

string

bool isAllowedToAuthenticate ()

Should the user be allowed to authenticate

Return Value

bool

isAllowedToMasquerade ()

bool|mixed|Admin hasPermission (int|string $permission)

Has a given permission within their assigned role group

Parameters

int|string $permission Either the permission name or the permission id

Return Value

bool|mixed|Admin