public function filterByUserCapabilities(Event $event, Query $query, ArrayObject $options): void
    {
        if (isset($options['accessCheck']) && ! $options['accessCheck']) {
            return;
        }

        $table = $event->getSubject();
        Assert::isInstanceOf($table, \Cake\ORM\Table::class);

        $filterQuery = new FilterQuery($query, $table, User::getCurrentUser());

        $filterQuery->execute();
    }
public function filterByUserCapabilities(Event $event, Query $query, ArrayObject $options): void
    {
        if (isset($options['accessCheck']) && ! $options['accessCheck']) {
            return;
        }

        $table = $event->getSubject();
        Assert::isInstanceOf($table, \Cake\ORM\Table::class);

        $filterQuery = new FilterQuery($query, $table, User::getCurrentUser());

        $filterQuery->execute();
    }
public function filterByUserCapabilities ( Event $ event , Query $ query , ArrayObject $ options ) : void { if ( isset ( $ options [ 'accessCheck' ] ) && ! $ options [ 'accessCheck' ] ) { return ; } $ table = $ event -> getSubject ( ) ; Assert :: isInstanceOf ( $ table , \ Cake \ ORM \ Table :: class ) ; $ filterQuery = new FilterQuery ( $ query , $ table , User :: getCurrentUser ( ) ) ; $ filterQuery -> execute ( ) ; }
Query filtering method based on current user capabilities.

Filtering can be skipped on per query basis by passing the
'accessCheck' option and set it to false.

Additionally filtering can be skipped on per table basis by
defining the table name in the plugin's configuration under
variable 'RolesCapabilities.ownerCheck.skipTables'.

@param \Cake\Event\Event $event The beforeFind event that was fired.
@param \Cake\ORM\Query $query Query
@param \ArrayObject $options The options for the query
@return void
Query filtering method based on current user capabilities .