AuthInterface
extends
AccessInterface
in
Auth interface
Table of Contents
Constants
- CONTROL_PANEL = 'ControlPanel'
- Control panel permission
- DELETE = ['delete']
- EXECUTE = ['execute']
- FULL = ['read', 'write', 'delete', 'execute']
- Full permissions
- READ = ['read']
- Read
- WRITE = ['write']
Methods
- addPermission() : bool
- Add permission item.
- authenticate() : bool
- Authenticate user
- getControlPanelPermission() : string
- Control panel permission name
- getFullPermissions() : array<string|int, mixed>
- Full Permissions
- getId() : int|null
- Get current auth id
- getLoginAttempts() : int|null
- Get login attempts
- getProvider() : AuthProviderInterface
- Return auth provider
- getUser() : array<string|int, mixed>|null
- Get current auth user
- getUserPermissions() : mixed
- Get user permissions list
- hasAccess() : bool
- Check access
- hasControlPanelAccess() : bool
- Check if current loged user have control panel access
- isLogged() : bool
- Return true if user is logged
- logout() : void
- Logout
- middleware() : object|null
- Create auth middleware
- resolveAuthType() : null|int
- Get auth name
- resolvePermissionName() : array<string|int, mixed>
- Resolve permission full name name:type
- withProvider() : AuthProviderInterface
- Change auth provider
Constants
CONTROL_PANEL
Control panel permission
public
mixed
CONTROL_PANEL
= 'ControlPanel'
DELETE
public
mixed
DELETE
= ['delete']
EXECUTE
public
mixed
EXECUTE
= ['execute']
FULL
Full permissions
public
mixed
FULL
= ['read', 'write', 'delete', 'execute']
READ
Read
public
mixed
READ
= ['read']
WRITE
public
mixed
WRITE
= ['write']
Methods
addPermission()
Add permission item.
public
addPermission(string $name[, string|null $title = null ][, string|null $description = null ][, string|null $extension = null ]) : bool
Parameters
- $name : string
- $title : string|null = null
- $description : string|null = null
- $extension : string|null = null
Return values
boolauthenticate()
Authenticate user
public
authenticate(array<string|int, mixed> $credentials) : bool
Parameters
- $credentials : array<string|int, mixed>
Return values
boolgetControlPanelPermission()
Control panel permission name
public
getControlPanelPermission() : string
Return values
stringgetFullPermissions()
Full Permissions
public
getFullPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>getId()
Get current auth id
public
getId() : int|null
Return values
int|nullgetLoginAttempts()
Get login attempts
public
getLoginAttempts() : int|null
Return values
int|nullgetProvider()
Return auth provider
public
getProvider() : AuthProviderInterface
Return values
AuthProviderInterfacegetUser()
Get current auth user
public
getUser() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetUserPermissions()
Get user permissions list
public
getUserPermissions([int|null $authId = null ]) : mixed
Parameters
- $authId : int|null = null
hasAccess()
Check access
public
hasAccess(string|int $name[, string|array<string|int, mixed>|null $type = null ][, int|null $authId = null ]) : bool
Parameters
- $name : string|int
-
Permission name
- $type : string|array<string|int, mixed>|null = null
-
PermissionType (read,write,execute,delete)
- $authId : int|null = null
Return values
boolhasControlPanelAccess()
Check if current loged user have control panel access
public
hasControlPanelAccess([int|null $authId = null ]) : bool
Parameters
- $authId : int|null = null
Return values
boolisLogged()
Return true if user is logged
public
isLogged() : bool
Return values
boollogout()
Logout
public
logout() : void
middleware()
Create auth middleware
public
middleware(string $authName[, array<string|int, mixed> $args = null ]) : object|null
Parameters
- $authName : string
- $args : array<string|int, mixed> = null
Return values
object|nullresolveAuthType()
Get auth name
public
resolveAuthType(string|int $type) : null|int
Parameters
- $type : string|int
Return values
null|intresolvePermissionName()
Resolve permission full name name:type
public
resolvePermissionName(string $name) : array<string|int, mixed>
Parameters
- $name : string
Return values
array<string|int, mixed>withProvider()
Change auth provider
public
withProvider(AuthProviderInterface|string $provider[, UserProviderInterface|null $user = null ][, array<string|int, mixed> $params = [] ]) : AuthProviderInterface
Parameters
- $provider : AuthProviderInterface|string
- $user : UserProviderInterface|null = null
- $params : array<string|int, mixed> = []