Skip to content

Acl

Class Acl

This class represents an Access Control List (ACL) and is used to configure and manage access permissions for different components.

Methods

get

Retrieves the ACL (Access Control List) based on the provided components and permissions.

public get(array $componentsName = ['components'], array|null $permissions = null, string $inherit = 'inherit'): \Phalcon\Acl\Adapter\Memory

Parameters:

Parameter Type Description
$componentsName array An array of component names to include in the ACL. Defaults to ['components'].
$permissions **array null**
$inherit string The type of role inheritance to use. Defaults to 'inherit'.

Return Value:

The ACL (Access Control List) object.


Inherited methods

__construct

Constructs a new instance of the class.

public __construct(array|null $options = null): mixed

Parameters:

Parameter Type Description
$options **array null**

initializeOptions

Initializes the options for the object.

public initializeOptions(array|null $options = null): void

Parameters:

Parameter Type Description
$options **array null**

initialize

Initializes the object.

public initialize(): void

This method is responsible for performing any necessary setup or initialization tasks for the object. It does not accept any parameters and does not return a value.


setOptions

Sets the options for the object.

public setOptions(array $options, bool $merge = false): void

Parameters:

Parameter Type Description
$options array The array of options to be set.
$merge bool Whether to merge the existing options with the new options. Defaults to false.

getOptions

Retrieves all options.

public getOptions(): array

Return Value:

An array containing all the options.


setOption

Sets the value of the option specified by the given key.

public setOption(string $key, mixed $value = null, bool $merge = false): void

Parameters:

Parameter Type Description
$key string The key of the option.
$value mixed The value to be set for the option.
$merge bool Whether to merge the new value with an existing value if the option already exists.

getOption

Retrieves the value of the option specified by the given key.

public getOption(string $key, mixed $default = null): mixed

Parameters:

Parameter Type Description
$key string The key of the option.
$default mixed The default value to be returned if the option does not exist.

Return Value:

The value of the option specified by the key, or the default value if the option does not exist.


hasOption

Checks if the option specified by the given key exists.

public hasOption(string $key): bool

Parameters:

Parameter Type Description
$key string The key of the option.

Return Value:

Returns true if the option exists, false otherwise.


removeOption

Remove an option by key

public removeOption(string $key): void

Removes the option with the given key from the options array.

Parameters:

Parameter Type Description
$key string The key of the option to be removed

resetOptions

Reset all options to their default values - Uses the defaultOptions property to set the options

public resetOptions(): void

clearOptions

Clear all options

public clearOptions(): void

This method clears all the options stored in the class. After calling this method, the options array will be empty.