Access
in package
implements
AccessInterface
Manage permissions.
Table of Contents
Interfaces
- AccessInterface
- Auth interface
Constants
- DEFAULT_AUTH_PROVIDER = 'session'
Properties
- $adapter : PermissionsInterface
- Permissions adapter
- $provider : AuthProviderInterface
- Undocumented variable
- $providerOptions : array<string|int, mixed>
- Auth provider options
Methods
- __construct() : mixed
- Constructor
- addPermission() : bool
- Add permission item.
- authenticate() : bool
- Auth user
- createProvider() : object|null
- Create auth provider
- getAdapter() : PermissionsInterface
- Get permissions adapter
- getControlPanelPermission() : string
- Control panel permission name
- getFullPermissions() : array<string|int, mixed>
- Full Permissions
- getId() : null|int|string
- Get auth id
- getLoginAttempts() : null|int
- Get login attempts
- getProvider() : AuthProviderInterface|null
- Return auth provider
- getUser() : array<string|int, mixed>|null
- Get logged user
- getUserPermissions() : mixed
- Get user permissions
- hasAccess() : bool
- Check access
- hasAccessOneFrom() : bool
- Return true if user has one permission from permissions list
- hasControlPanelAccess() : bool
- Check if current loged user have control panel access
- hasDeny() : bool
- Check for deny permission
- isLogged() : bool
- Return true if user is logged
- logout() : void
- Logout
- middleware() : object|null
- Create auth middleware
- resolveAuthType() : null|string
- Resolve auth type
- resolvePermissionName() : array<string|int, mixed>
- Resolve permission full name name:type
- setAdapter() : void
- Set permissions adapter
- setProvider() : void
- Set auth provider
- withProvider() : AuthProviderInterface
- Change auth provider
- resolvePermissionType() : array<string|int, mixed>
- Resolve permission type
Constants
DEFAULT_AUTH_PROVIDER
public
mixed
DEFAULT_AUTH_PROVIDER
= 'session'
Properties
$adapter
Permissions adapter
private
PermissionsInterface
$adapter
$provider
Undocumented variable
private
AuthProviderInterface
$provider
= null
$providerOptions
Auth provider options
private
array<string|int, mixed>
$providerOptions
= []
Methods
__construct()
Constructor
public
__construct(PermissionsInterface $adapter[, AuthProviderInterface|null $provider = null ][, array<string|int, mixed> $providerOptions = [] ]) : mixed
Parameters
- $adapter : PermissionsInterface
- $provider : AuthProviderInterface|null = null
- $providerOptions : array<string|int, mixed> = []
addPermission()
Add permission item.
public
addPermission(string $name[, string|null $title = null ][, string|null $description = null ][, string|null $extension = null ][, bool|null $deny = false ]) : bool
Parameters
- $name : string
- $title : string|null = null
- $description : string|null = null
- $extension : string|null = null
- $deny : bool|null = false
Return values
boolauthenticate()
Auth user
public
authenticate(array<string|int, mixed> $credentials) : bool
Parameters
- $credentials : array<string|int, mixed>
Return values
boolcreateProvider()
Create auth provider
public
createProvider(string $name[, array<string|int, mixed>|null $params = null ]) : object|null
Parameters
- $name : string
- $params : array<string|int, mixed>|null = null
Return values
object|nullgetAdapter()
Get permissions adapter
public
getAdapter() : PermissionsInterface
Return values
PermissionsInterfacegetControlPanelPermission()
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 auth id
public
getId() : null|int|string
Return values
null|int|stringgetLoginAttempts()
Get login attempts
public
getLoginAttempts() : null|int
Return values
null|intgetProvider()
Return auth provider
public
getProvider() : AuthProviderInterface|null
Return values
AuthProviderInterface|nullgetUser()
Get logged user
public
getUser() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetUserPermissions()
Get user permissions
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 ][, string|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 : string|int|null = null
Return values
boolhasAccessOneFrom()
Return true if user has one permission from permissions list
public
hasAccessOneFrom(array<string|int, mixed>|string $names[, string|array<string|int, mixed>|null $type = null ][, string|int|null $authId = null ]) : bool
Parameters
- $names : array<string|int, mixed>|string
-
Permission names
- $type : string|array<string|int, mixed>|null = null
-
PermissionType (read,write,execute,delete)
- $authId : string|int|null = null
Return values
boolhasControlPanelAccess()
Check if current loged user have control panel access
public
hasControlPanelAccess([string|int|null $authId = null ]) : bool
Parameters
- $authId : string|int|null = null
Return values
boolhasDeny()
Check for deny permission
public
hasDeny(string|int $name[, string|array<string|int, mixed>|null $type = null ][, string|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 : string|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[, object|null $container = null ][, array<string|int, mixed> $options = [] ]) : object|null
Parameters
- $authName : string
- $container : object|null = null
- $options : array<string|int, mixed> = []
Return values
object|nullresolveAuthType()
Resolve auth type
public
resolveAuthType(string|null|array<string|int, mixed> $type) : null|string
Parameters
- $type : string|null|array<string|int, mixed>
Return values
null|stringresolvePermissionName()
Resolve permission full name name:type
public
resolvePermissionName(string $name) : array<string|int, mixed>
Parameters
- $name : string
Return values
array<string|int, mixed>setAdapter()
Set permissions adapter
public
setAdapter(PermissionsInterface $adapter) : void
Parameters
- $adapter : PermissionsInterface
setProvider()
Set auth provider
public
setProvider(AuthProviderInterface $provider) : void
Parameters
- $provider : AuthProviderInterface
withProvider()
Change auth provider
public
withProvider(AuthProviderInterface|string $provider[, array<string|int, mixed> $params = [] ]) : AuthProviderInterface
Parameters
- $provider : AuthProviderInterface|string
- $params : array<string|int, mixed> = []
Return values
AuthProviderInterfaceresolvePermissionType()
Resolve permission type
protected
resolvePermissionType(string|array<string|int, mixed> $type) : array<string|int, mixed>
Parameters
- $type : string|array<string|int, mixed>