# WHMCS\User\Admin

`Class` · extends `AbstractUser` · implements `UserInterface`

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.
phpcs:disable

## Traits

- `Authenticatable`
- `UserTrait`


## Constants

| Name | Description |
|  --- | --- |
| `TEMPLATE_THEME_DEFAULT` |  |
| `MAXIMUM_PASSWORD_LENGTH` |  |


## Properties

| Type | Name | Description |
|  --- | --- | --- |
| `` | `$unique` |  |


## Methods

### getSecondFactorModuleName

```php
public function getSecondFactorModuleName()
```

### getSecondFactorConfigName

```php
public function getSecondFactorConfigName()
```

### getFullNameAttribute

```php
public function 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.

**Returns** `string` — The combined name

### getGravatarHashAttribute

```php
public function getGravatarHashAttribute()
```

Get gravatar email address hash.

**Returns** `string`

### getUsernameAttribute

```php
public function 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.

**Returns** `string`

### isAllowedToAuthenticate

```php
public function isAllowedToAuthenticate()
```

Should the user be allowed to authenticate

**Returns** `bool`

### isAllowedToMasquerade

```php
public function isAllowedToMasquerade()
```

**Returns** `bool`

### hasPermission

```php
public function hasPermission($permission)
```

Has a given permission within their assigned role group

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `int|string` | `$permission` | Either the permission name or the permission id |


**Returns** `bool`

### getRoleName

```php
public function getRoleName()
```

Get assigned admin role group name.

**Returns** `string`

### getRolePermissions

```php
public function getRolePermissions()
```

Array of permission names available to this admin user

**Returns** `array`

### getModulePermissions

```php
public function getModulePermissions()
```

**Returns** `array`

### authenticationDevices

```php
public function authenticationDevices()
```

**Returns** `\Illuminate\Database\Eloquent\Relations\HasMany`

### getTemplateThemeNameAttribute

```php
public function getTemplateThemeNameAttribute()
```

**Returns** `string`

### validateUsername

```php
public function validateUsername($username, $existingUserId = null)
```

Validate admin username is valid.

Optionally also validate it is unique. Requires passing in of
existing admin user ID or 0 for a new admin user creation.

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `string` | `$username` |  |
| `int|null` | `$existingUserId` | Optional, pass to validate uniqueness |


### flaggedTickets

```php
public function flaggedTickets()
```

An admin can have many flagged tickets.

**Returns** `HasMany`

### scopeActive

```php
public function scopeActive(Builder $query)
```

Return only active Admin users

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |


**Returns** `Builder`

### getAuthenticatedUser

```php
public static function getAuthenticatedUser()
```

Get the currently authenticated admin user.

**Returns** `self\|null`

### getSupportDepartmentIds

```php
public function getSupportDepartmentIds()
```

Get support department ids.

**Returns** `int[]`

### setSecondFactorConfig

```php
public function setSecondFactorConfig(array $value): self
```

### getAuthIdentifierName

```php
public function getAuthIdentifierName()
```