‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Database\Query\Restriction\PagePermissionRestriction Class Reference
Inheritance diagram for TYPO3\CMS\Core\Database\Query\Restriction\PagePermissionRestriction:
TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionInterface

Public Member Functions

 __construct (UserAspect $userAspect, int $permissions)
 
CompositeExpression buildExpression (array $queriedTables, ExpressionBuilder $expressionBuilder)
 

Protected Member Functions

string CompositeExpression null buildUserConstraints (ExpressionBuilder $expressionBuilder, string $tableAlias)
 

Protected Attributes

int $permissions
 
UserAspect $userAspect
 

Detailed Description

Restriction to make queries respect backend user rights for pages.

Adds a WHERE-clause for the pages-table where user permissions according to input argument, $permissions, is validated. $permissions is the "mask" used to select - see Permission Bitset. E.g. if $perms is 1 then you'll get all pages that a user can actually see! 2^0 = show (1) 2^1 = edit (2) 2^2 = delete (4) 2^3 = new (8) If the user is 'admin' no validation is used.

If the user is not set at all (->user is not an array), then "AND 1=0" is returned (will cause no selection results at all)

The 95% use of this function is "->getPagePermsClause(1)" which will return WHERE clauses for selecting pages in backend listings - in other words this will check read permissions.

Definition at line 41 of file PagePermissionRestriction.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Database\Query\Restriction\PagePermissionRestriction::__construct ( UserAspect  $userAspect,
int  $permissions 
)

Member Function Documentation

◆ buildExpression()

CompositeExpression TYPO3\CMS\Core\Database\Query\Restriction\PagePermissionRestriction::buildExpression ( array  $queriedTables,
ExpressionBuilder  $expressionBuilder 
)

Main method to build expressions for given tables

Parameters
array$queriedTables‪Array of tables, where array key is table alias and value is a table name
ExpressionBuilder$expressionBuilderExpression builder instance to add restrictions with
Returns
‪CompositeExpression The result of query builder expression(s)

Implements TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionInterface.

Definition at line 64 of file PagePermissionRestriction.php.

References TYPO3\CMS\Core\Database\Query\Expression\ExpressionBuilder\and(), and TYPO3\CMS\Core\Database\Query\Restriction\PagePermissionRestriction\buildUserConstraints().

◆ buildUserConstraints()

Member Data Documentation

◆ $permissions

int TYPO3\CMS\Core\Database\Query\Restriction\PagePermissionRestriction::$permissions
protected

◆ $userAspect

UserAspect TYPO3\CMS\Core\Database\Query\Restriction\PagePermissionRestriction::$userAspect
protected