Using the identity helper in AppView
$this->loadHelper('Authentication.Identity');
To get the id user logged is
$this->Identity->get('id');
More in https://book.cakephp.org/authentication/3/en/view-helper.html