Issue Task Closed

#105690Allow table alias for BackendUserAuthentication->getPagePermsClause

Anja Leichsenring 11/25/24, 06:09 updated 11/25/24, 07:51

Description

The method provides a chunk of constraints to add to a custom query, taking care of page permissions for the logged in user.

Problem: the method will act upon the full table name ‘pages’, making it impossible to use page aliases for the query.

Example:

$queryBuilder = $connectionPool->getQueryBuilderForTable('pages);
$queryBuilder->select('*')->from('pages', 'p')->where(...);
$queryBuilder->andWhere(
       QueryHelper::stripLogicalOperatorPrefix($GLOBALS['BE_USER']->getPagePermsClause(Permission::PAGE_SHOW)),
);

will lead to error like ‘field pages.perms_everybody not known’.

In order to allow usage of alias, a second parameter to the function can be added and used.

Reviews 1