Class Permissions
Permissions management
Controls which options are available for setting the Access Control List's
Control Objects as well as offers an interface for interacting with the ACL
-
Model
-
AppModel
-
Permissions
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
Fetches the given permission record from the database
Parameters
- $id
integer $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
|
#
getGroup( integer $group_id )
Fetches the given permission group record from the database
Fetches the given permission group record from the database
Parameters
- $group_id
integer $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
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
string $level The level to fetch permissions for ('staff', or 'client')
- $company_id
integer $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
string $aro The ARO to fetch permissions for
- $level
string $level The level to fetch permissions for ('staff' or 'client')
- $company_id
integer $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, mixed $action, mixed $level, mixed $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
string $aro The ARO to verify can access the ACO
- $aco
string $aco The ACO to verify can be accessed by the ARO
- $action
- $level
- $company_id
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
array $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
integer $id The ID of the permission field to update
- $vars
array $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
integer $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
array $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
integer $id The ID of the permission group to update
- $vars
array $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
integer $id The ID of the permission field to delete
|
private
array
|
#
getRules( array $vars )
Returns add/edit rules for Permission fields
Returns add/edit rules for Permission fields
Parameters
- $vars
array $vars An array of input vars
Returns
array An array containing the validation rules
|
private
array
|
#
getGroupRules( array $vars )
Returns add/edit rules for Permission Groups
Returns add/edit rules for Permission Groups
Parameters
- $vars
array $vars An array of input vars
Returns
array An array containing the validation rules
|
Methods inherited from AppModel
_()
,
boolToInt()
,
currencyToDecimal()
,
dateToUtc()
,
errors()
,
getPerPage()
,
ifSet()
,
loadCrypto()
,
setDefaultIfEmpty()
,
setPerPage()
,
setRulesIfSet()
,
strToBool()
,
systemDecrypt()
,
systemEncrypt()
,
systemHash()
,
truncateDecimal()
,
validateExists()
,
validateStateCountry()
Methods inherited from Model
affectedRows()
,
begin()
,
commit()
,
getConnection()
,
lastInsertId()
,
makeDSN()
,
prepare()
,
query()
,
rollBack()
,
setAttribute()
,
setFetchMode()
Magic methods summary
Properties summary
Properties inherited from AppModel
$replacement_keys