Overview

Namespaces

  • PHP
  • ProgrammingAreHard
    • Arbiter
      • Domain
      • Model
  • Symfony
    • Component
      • Security
        • Acl
          • Exception
          • Model
          • Permission
        • Core
          • User

Classes

  • BasicPermissionMap
  • MaskBuilder

Interfaces

  • PermissionMapInterface
  • Overview
  • Namespace
  • Class
  • Tree

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
Methods summary
public
# __construct( integer $mask = 0 )

Constructor

Constructor

Parameters

$mask
integer
$mask optional; defaults to 0

Throws

InvalidArgumentException
public Symfony\Component\Security\Acl\Permission\MaskBuilder
# add( mixed $mask )

Adds a mask to the permission

Adds a mask to the permission

Parameters

$mask
mixed
$mask

Returns

Symfony\Component\Security\Acl\Permission\MaskBuilder

Throws

InvalidArgumentException
public integer
# get( )

Returns the mask of this permission

Returns the mask of this permission

Returns

integer
public string
# getPattern( )

Returns a human-readable representation of the permission

Returns a human-readable representation of the permission

Returns

string
public Symfony\Component\Security\Acl\Permission\MaskBuilder
# remove( mixed $mask )

Removes a mask from the permission

Removes a mask from the permission

Parameters

$mask
mixed
$mask

Returns

Symfony\Component\Security\Acl\Permission\MaskBuilder

Throws

InvalidArgumentException
public Symfony\Component\Security\Acl\Permission\MaskBuilder
# reset( )

Resets the PermissionBuilder

Resets the PermissionBuilder

Returns

Symfony\Component\Security\Acl\Permission\MaskBuilder
public static string
# getCode( integer $mask )

Returns the code for the passed mask

Returns the code for the passed mask

Parameters

$mask
integer
$mask

Returns

string

Throws

InvalidArgumentException
RuntimeException
Constants summary
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 '*'
#
Arbiter API documentation generated by ApiGen 2.8.0