PagePermissionRestriction implements QueryRestrictionInterface
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.
Table of Contents
Interfaces
- QueryRestrictionInterface
- The main restriction interface. All restrictions (including the collections) must implement this.
Properties
- $permissions : int
- $userAspect : UserAspect
Methods
- __construct() : mixed
- buildExpression() : CompositeExpression
- Main method to build expressions for given tables
- buildUserConstraints() : string|CompositeExpression|null
Properties
$permissions
        protected
            int
    $permissions
    
    
    
    
    
    
$userAspect
        protected
            UserAspect
    $userAspect
    
    
    
    
    
    
Methods
__construct()
    public
                    __construct(UserAspect $userAspect, int $permissions) : mixed
    Parameters
- $userAspect : UserAspect
- $permissions : int
buildExpression()
Main method to build expressions for given tables
    public
                    buildExpression(array<string|int, mixed> $queriedTables, ExpressionBuilder $expressionBuilder) : CompositeExpression
    Parameters
- $queriedTables : array<string|int, mixed>
- 
                    Array of tables, where array key is table alias and value is a table name 
- $expressionBuilder : ExpressionBuilder
- 
                    Expression builder instance to add restrictions with 
Return values
CompositeExpression —The result of query builder expression(s)
buildUserConstraints()
    protected
                    buildUserConstraints(ExpressionBuilder $expressionBuilder, string $tableAlias) : string|CompositeExpression|null
    Parameters
- $expressionBuilder : ExpressionBuilder
- $tableAlias : string