Documentation

AdminAuthInterface extends ServiceInterface

Provides admin authentication functions for the back-end

Table of Contents

Methods

changePassword()  : mixed
Sets the password for a operator, or the current operator if a operator-id is not specified.
checkLogin()  : void
If the user is not logged in, redirect them to a login page.
configure()  : void
Configure the service.
createUser()  : int
Create a new user with a set of details, excluding password
deleteUser()  : bool
Delete an operator. Called after the standard internal deletion
getDetails()  : array<string|int, mixed>|bool
Gets the id, name, username and email of the currently logged in operator.
getId()  : int
Gets id of logged-in user
getLocalId()  : int
Fetches the ID of current operator if and only if they're a local operator, otherwise 0.
getSessionKey()  : string
Get the session key, e.g. 'admin'
hasDatabaseRecord()  : bool
Does the record-id for this login correspond to a local database record?
isLoggedIn()  : bool
Check if the user is logged in or not
isSuper()  : bool
A super-operator -- has access to everything (dev tools, all permissions, etc)
loginComplete()  : string
Set up various login params and redirect into admin
logout()  : void
Log a user out of the system
updateDetails()  : bool
Update a set of details for a user, excluding password

Methods

changePassword()

Sets the password for a operator, or the current operator if a operator-id is not specified.

public static changePassword(string $new_password[, int|null $operator_id = null ]) : mixed
Parameters
$new_password : string

The new password.

$operator_id : int|null = null

The operator to update. If not specified, the currently logged in operator is used.

checkLogin()

If the user is not logged in, redirect them to a login page.

public static checkLogin([string $msg = null ]) : void
Parameters
$msg : string = null

Optional message to display on the login page

configure()

Configure the service.

public static configure(array<string|int, mixed> $config) : void
Parameters
$config : array<string|int, mixed>

createUser()

Create a new user with a set of details, excluding password

public static createUser(array<string|int, mixed> $details, string $password) : int
Parameters
$details : array<string|int, mixed>
$password : string
Return values
int —

The ID of the new user

deleteUser()

Delete an operator. Called after the standard internal deletion

public static deleteUser(int $item_id) : bool
Parameters
$item_id : int
Return values
bool

getDetails()

Gets the id, name, username and email of the currently logged in operator.

public static getDetails() : array<string|int, mixed>|bool

N.B. the id will be 0 for remote users

Return values
array<string|int, mixed>|bool —

Under normal circumstances, with keys 'id', 'name', 'username', 'email' and 'editor'. False if fetching data for a remote operator failed

getId()

Gets id of logged-in user

public static getId() : int
Return values
int —

0 if user isn't logged in

getLocalId()

Fetches the ID of current operator if and only if they're a local operator, otherwise 0.

public static getLocalId() : int
Return values
int —

An ID if a local operator, 0 otherwise

getSessionKey()

Get the session key, e.g. 'admin'

public static getSessionKey() : string
Return values
string

hasDatabaseRecord()

Does the record-id for this login correspond to a local database record?

public static hasDatabaseRecord() : bool
Return values
bool —

True if the logged-in operator has a database record

isLoggedIn()

Check if the user is logged in or not

public static isLoggedIn() : bool
Return values
bool —

True if the user is logged in, false otherwise

isSuper()

A super-operator -- has access to everything (dev tools, all permissions, etc)

public static isSuper() : bool
Return values
bool —

True if the logged-in user is a super-operator

loginComplete()

Set up various login params and redirect into admin

public static loginComplete([string|null $username = '' ][, string|null $redirect = '' ]) : string

Called after a successful login (either one-factor or two-factor)

Parameters
$username : string|null = ''

Provided username or empty string

$redirect : string|null = ''

URL to redirect to after login (or empty string)

Return values
string —

URL to redirect to

updateDetails()

Update a set of details for a user, excluding password

public static updateDetails(int $item_id, array<string|int, mixed> $details) : bool
Parameters
$item_id : int
$details : array<string|int, mixed>
Return values
bool
On this page

Search results