AdminAuth
in package
implements
AdminAuthInterface
Provides user authentication functions for the admin
Table of Contents
Interfaces
- AdminAuthInterface
- Provides admin authentication functions for the back-end
Properties
- $inst : AdminAuthInterface|null
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.
- checkPassword() : mixed
- checkRateLimit() : mixed
- 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
- getAllCategories() : mixed
- getDetails() : array<string|int, mixed>|bool
- Gets the id, name, username and email of the currently logged in operator.
- getEmail() : string|null
- Get the email of the current or a specified 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.
- getOperatorCategories() : mixed
- getPrimaryCategoryId() : mixed
- getSessionKey() : string
- Get the session key, e.g. 'admin'
- hasDatabaseRecord() : bool
- Does the record-id for this login correspond to a local database record?
- inCategory() : mixed
- injectLocalSuperConf() : mixed
- 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
- processLocal() : mixed
- processLogin() : mixed
- processOpenid() : mixed
- processRemote() : mixed
- saveLoginAttempt() : mixed
- updateDetails() : bool
- Update a set of details for a user, excluding password
- getInst() : AdminAuthInterface
- Get an instance of the current AdminAuthInterface implementation
Properties
$inst
private
static AdminAuthInterface|null
$inst
Methods
changePassword()
Sets the password for a operator, or the current operator if a operator-id is not specified.
public
static changePassword(mixed $new_password[, mixed $operator_id = null ]) : mixed
Parameters
- $new_password : mixed
-
The new password.
- $operator_id : mixed = null
-
The operator to update. If not specified, the currently logged in operator is used.
Tags
checkLogin()
If the user is not logged in, redirect them to a login page.
public
static checkLogin([mixed $msg = null ]) : void
Parameters
- $msg : mixed = null
-
Optional message to display on the login page
Tags
checkPassword()
public
static checkPassword(mixed $password[, mixed $operator_id = null ]) : mixed
use CoreAdminAuth
Parameters
- $password : mixed
- $operator_id : mixed = null
checkRateLimit()
public
static checkRateLimit(mixed $username, mixed $ip) : mixed
use CoreAdminAuth
Parameters
- $username : mixed
- $ip : mixed
configure()
Configure the service.
public
static configure(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
Tags
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
Tags
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
Tags
Return values
boolgetAllCategories()
public
static getAllCategories() : mixed
use CoreAdminAuth
getDetails()
Gets the id, name, username and email of the currently logged in operator.
public
static getDetails() : array<string|int, mixed>|bool
Tags
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
getEmail()
Get the email of the current or a specified operator
public
static getEmail([null|int $operator_id = null ]) : string|null
Parameters
- $operator_id : null|int = null
Return values
string|nullgetId()
Gets id of logged-in user
public
static getId() : int
Tags
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
Tags
Return values
int —An ID if a local operator, 0 otherwise
getOperatorCategories()
public
static getOperatorCategories() : mixed
use CoreAdminAuth
getPrimaryCategoryId()
public
static getPrimaryCategoryId() : mixed
use CoreAdminAuth
getSessionKey()
Get the session key, e.g. 'admin'
public
static getSessionKey() : string
Tags
Return values
stringhasDatabaseRecord()
Does the record-id for this login correspond to a local database record?
public
static hasDatabaseRecord() : bool
Tags
Return values
bool —True if the logged-in operator has a database record
inCategory()
public
static inCategory(mixed $category_id) : mixed
use CoreAdminAuth
Parameters
- $category_id : mixed
injectLocalSuperConf()
public
static injectLocalSuperConf(mixed $username, mixed $pass_hash, mixed $pass_salt) : mixed
use CoreAdminAuth
Parameters
- $username : mixed
- $pass_hash : mixed
- $pass_salt : mixed
isLoggedIn()
Check if the user is logged in or not
public
static isLoggedIn() : bool
Tags
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
Tags
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
Parameters
- $username : string|null = ''
-
Provided username or empty string
- $redirect : string|null = ''
-
URL to redirect to after login (or empty string)
Tags
Return values
string —URL to redirect to
logout()
Log a user out of the system
public
static logout() : void
Tags
processLocal()
public
static processLocal(mixed $username, mixed $password) : mixed
use CoreAdminAuth
Parameters
- $username : mixed
- $password : mixed
processLogin()
public
static processLogin(mixed $username, mixed $password) : mixed
use CoreAdminAuth
Parameters
- $username : mixed
- $password : mixed
processOpenid()
public
static processOpenid(mixed $openid) : mixed
use CoreAdminAuth
Parameters
- $openid : mixed
processRemote()
public
static processRemote(mixed $username, mixed $password) : mixed
use CoreAdminAuth
Parameters
- $username : mixed
- $password : mixed
saveLoginAttempt()
public
static saveLoginAttempt(mixed $username, mixed $ip, mixed $success) : mixed
use CoreAdminAuth
Parameters
- $username : mixed
- $ip : mixed
- $success : mixed
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>
Tags
Return values
boolgetInst()
Get an instance of the current AdminAuthInterface implementation
private
static getInst() : AdminAuthInterface