Class MaskBuilder
This class allows you to build cumulative permissions easily, or convert masks to a human-readable format.
$builder = new MaskBuilder(); $builder ->add('view') ->add('create') ->add('edit') ; var_dump($builder->get()); // int(7) var_dump($builder->getPattern()); // string(32) ".............................ECV"
We have defined some commonly used base permissions which you can use:
- VIEW: the SID is allowed to view the domain object / field
- CREATE: the SID is allowed to create new instances of the domain object / fields
- EDIT: the SID is allowed to edit existing instances of the domain object / field
- DELETE: the SID is allowed to delete domain objects
- UNDELETE: the SID is allowed to recover domain objects from trash
- OPERATOR: the SID is allowed to perform any action on the domain object except for granting others permissions
- MASTER: the SID is allowed to perform any action on the domain object, and is allowed to grant other SIDs any permission except for MASTER and OWNER permissions
- OWNER: the SID is owning the domain object in question and can perform any action on the domain object as well as grant any permission
Namespace: Symfony\Component\Security\Acl\Permission
Author: Johannes M. Schmitt <schmittjoh@gmail.com>
Located at MaskBuilder.php
Author: Johannes M. Schmitt <schmittjoh@gmail.com>
Located at MaskBuilder.php
public
|
|
public
|
|
public
integer
|
|
public
string
|
|
public
|
|
public
|
|
public static
string
|
integer |
MASK_VIEW
|
1 |
|
integer |
MASK_CREATE
|
2 |
|
integer |
MASK_EDIT
|
4 |
|
integer |
MASK_DELETE
|
8 |
|
integer |
MASK_UNDELETE
|
16 |
|
integer |
MASK_OPERATOR
|
32 |
|
integer |
MASK_MASTER
|
64 |
|
integer |
MASK_OWNER
|
128 |
|
integer |
MASK_IDDQD
|
1073741823 |
|
string |
CODE_VIEW
|
'V' |
|
string |
CODE_CREATE
|
'C' |
|
string |
CODE_EDIT
|
'E' |
|
string |
CODE_DELETE
|
'D' |
|
string |
CODE_UNDELETE
|
'U' |
|
string |
CODE_OPERATOR
|
'O' |
|
string |
CODE_MASTER
|
'M' |
|
string |
CODE_OWNER
|
'N' |
|
string |
ALL_OFF
|
'................................' |
|
string |
OFF
|
'.' |
|
string |
ON
|
'*' |