Download the PHP package thelia/customer-group-acl-module without Composer
On this page you can find all versions of the php package thelia/customer-group-acl-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package customer-group-acl-module
CustomerGroupAcl
Extends the CustomerGroup module with an access control list mechanism that can be used to allow or deny access to some resource to a customer group.
Installation
Manually
- Copy the module into directory and make sure that the name of the module is CustomerGroupAcl.
- Activate it in your Thelia administration panel
Composer
Add it in your main Thelia composer.json file
Update
0.1.3
- Change acl data table to add class_name, the class name to check specific object acl ;
- Dispatch
CheckAclEvent_[resource]
; - Change checkAcl definition to checkAcl($resources, $accesses, $accessOr = false, $entityId = null, $dispatchEvent = false) :
- $entityId, object identifying, if isset resources must be alone,
- $dispatchEvent, if is set, CheckAclEvent are dispatch, default false ;
Execute setup/update-0.1.2-0.1.3.sql
script.
Configuration
Using the configuration file
Modules that use customer group ACLs must define them in the acl.xml
file in the module configuration directory.
The ACLs will be created when the module is activated.
Since ACLs are applied to customer group, you must have already have created some in order to use them
(see the CustomerGroup module documentation).
In this exemple, we will assume that the client
, vip
, also-vip-1
and also-vip-2
groups exists.
Here we define an ACL resource vip-perks
and grant VIEW
type access to this resource to the vip
group.
The extra-vip-1
group is set to have the same accesses as the vip
group.
The extra-vip-2
group is also set to have the same rights as the vip
group, but only for the vip-perks
ACL resource.
Using the back office
ACLs and group accesses can also be configured in the Thelia back office. A link to the configuration page is available in the Tools menu.
Access types
The available access types are defined in the Thelia access manager:
VIEW
CREATE
UPDATE
DELETE
Additionally, the ALL
access can be used to grant all available accesses.
Check group access
PHP
The customer_group_acl.tool
can be used to check ACL access.
Smarty
Smarty plugins are provided to check ACL access in templates.
As with the PHP function, you can check multiple resources and accesses at once, and optionally require only one access.
Simple check
The check_acl
function will throw an exception if the required access(es) are not granted.
Block check
The acl
and elseacl
tags can also be used to check ACL accesses with a block syntax.
Loop
acl
This loop list ACLs.
Input arguments
Argument | Description |
---|---|
id | Id or list of ACL ids. |
module | Id or list of module ids. |
code | Code or list of ACL codes. |
order | Order of the results. |
lang | Locale of the results. |
order can be one of:
id
(default)module
module_reverse
Output arguments
Variable | Description |
---|---|
$ACL_ID | ACL id. |
$MODULE_ID | Id of the module defining the ACL. |
$CODE | ACL code. |
$TITLE | ACL title in the selected locale. |
$DESCRIPTION | ACL description in the selected locale. |
customer-group-acl
This loop list customer group access grants.
Input arguments
Argument | Description |
---|---|
acl | Id or list of ACL ids. |
customer_group | Id or list of customer group ids. |
acl_type | Access type or list of access types. |
activate | Whether to only list active access grants (true ) or not (false ) or both (* ). |
Output arguments
Variable | Description |
---|---|
$ACL_ID | ACL id. |
$CUSTOMER_GROUP_ID | Customer group id. |
$TYPE | Access type. |
$ACTIVATE | Whether the access grant is active. |