Methods summary
public
|
#
__construct( )
Loads the ACL for processing
Loads the ACL for processing
Overrides
|
public
mixed
|
#
get( integer $id )
Fetches the given permission record from the database by ID
Fetches the given permission record from the database by ID
Parameters
- $id
- The permission ID to fetch
Returns
mixed A stdClass object representing a permission field, false if the permission field does not exist
|
public
mixed
|
#
getByAlias( string $alias, integer $plugin_id = null, string $action = null )
Fetches the given permission record from the database by alias
Fetches the given permission record from the database by alias
Parameters
- $alias
- The permission alias to fetch
- $plugin_id
- The ID of the plugin (null if not part of a plugin) the alias belongs to
- $action
- The permission action to fetch (null fetches 1st match on alias)
Returns
mixed A stdClass object representing a permission field, false if the permission field does not exist
|
public
mixed
|
#
getGroup( integer $group_id )
Fetches the given permission group record from the database by ID
Fetches the given permission group record from the database by ID
Parameters
- $group_id
- The permission group ID to fetch
Returns
mixed A stdClass object representing a permission group, false if the permission group does not exist
|
public
mixed
|
#
getGroupByAlias( string $group_alias, integer $plugin_id = null )
Fetches the given permission group record from the database by alias
Fetches the given permission group record from the database by alias
Parameters
- $group_alias
- The permission group alias to fetch
- $plugin_id
- The ID of the plugin (null if not part of a plugin) the alias belongs to
Returns
mixed A stdClass object representing a permission group, false if the permission group does not exist
|
public
array
|
#
getAll( string $level, integer $company_id )
Fetches all permission fields divided under each permission category.
Fetches all permission fields divided under each permission category.
Parameters
- $level
- The level to fetch permissions for ('staff', or 'client')
- $company_id
- The company to fetch permissions for
Returns
array An array of stdClass objects each representing a
permission group. Each permission group also contains an array of
permission fields representing as stdClass objects
|
public
stdClass
|
#
fromAcl( string $aro, string $level, integer $company_id )
Fetches a set of permission groups and permission fields that the given group has access to on the
provided level and company
Fetches a set of permission groups and permission fields that the given group has access to on the
provided level and company
Parameters
- $aro
- The ARO to fetch permissions for
- $level
- The level to fetch permissions for ('staff' or 'client')
- $company_id
- The ID of the company to fetch permissions for
Returns
stdClass A stdClass object containing the following:
- permission_group An numerically indexed array of permission group IDs that this ARO is allowed to access
- permission A numerically indexed array of permission field IDs that this ARO is allowed to access
|
public
boolean
|
#
authorized( string $aro, string $aco, string $action, string $level, integer $company_id )
Verifies whether the given ARO is authorized to access the given ACO on the given action
Verifies whether the given ARO is authorized to access the given ACO on the given action
Parameters
- $aro
- The ARO to verify can access the ACO
- $aco
- The ACO to verify can be accessed by the ARO
- $action
- The action permission
- $level
- The permission group level
- $company_id
- The ID of the company
Returns
boolean True if the ARO is authorized to access the ACO or if the
permission or permission group does not exist, false otherwise
|
public
integer
|
#
add( array $vars )
Adds a new permission field to the system (also adds the permission to the ACL)
Adds a new permission field to the system (also adds the permission to the ACL)
Parameters
- $vars
An array of input fields including:
- group_id The ID of the permission group this permission belongs to
- name The name of this permission (language definition or plain-text)
- alias The ACO alias for this permission (i.e. the Class name to apply to)
- action The action this ACO may control (i.e. the Method name of the alias to control access for)
- plugin_id The ID of the plugin this action belongs to (if any)
Returns
integer The ID of the permission record on success, void one error
|
public
|
#
edit( integer $id, array $vars )
Updates the permission field in the system (also adds the permission to the ACL if needed)
Updates the permission field in the system (also adds the permission to the ACL if needed)
Parameters
- $id
- The ID of the permission field to update
- $vars
An array of input fields including:
- group_id The ID of the permission group this permission belongs to
- name The name of this permission (language definition or plain-text)
- alias The ACO alias for this permission (i.e. the Class name to apply to)
- action The action this ACO may control (i.e. the Method name of the alias to control access for)
- plugin_id The ID of the plugin this action belongs to (if any)
|
public
|
#
delete( integer $id )
Deletes the permission field from the system, also removes the items from the ACL
Deletes the permission field from the system, also removes the items from the ACL
Parameters
- $id
- The ID of the permission field to delete
|
public
integer
|
#
addGroup( array $vars )
Adds a new permission group to the system (also adds the permission to the ACL)
Adds a new permission group to the system (also adds the permission to the ACL)
Parameters
- $vars
An array of input fields including:
- name The name of this permission group (language definition or plain-text)
- level The level this permission group resides on (staff or client)
- alias The ACO alias for this permission group (i.e. the Class name to apply to)
- plugin_id The ID of the plugin this permission group belongs to (if any)
Returns
integer The ID of the permission group on success, void one error
|
public
|
#
editGroup( integer $group_id, array $vars )
Updates the permission group in the system (also adds the permission to the ACL if needed)
Updates the permission group in the system (also adds the permission to the ACL if needed)
Parameters
- $group_id
- The ID of the permission group to update
- $vars
An array of input fields including:
- name The name of this permission group (language definition or plain-text)
- level The level this permission group resides on (staff or client)
- alias The ACO alias for this permission group (i.e. the Class name to apply to)
- plugin_id The ID of the plugin this permission group belongs to (if any)
|
public
|
#
deleteGroup( integer $group_id )
Deletes the permission group from the system, also removes the items from the ACL
Deletes the permission group from the system, also removes the items from the ACL
Parameters
- $group_id
- The ID of the permission group to delete
|