Fresh install with CakePHP 5.1 walked through the CMS tutorial and got everything working. Started added the Authorization features and now get an error on all pages index functions. Just to get working with basics the User Policy I’ve added.
src\Policy\UserPolicy.php
public function canIndex(IdentityInterface $user, user $resource)
{
// All logged in users can index.
return true;
}
Looking at vendor\cakephp\authorization\src\Policy\OrmResolver.php
protected function findPolicy(string $class, string $name, string $namespace): mixed
$name is being passed “UsersTable” for index functions whereas all other functions are being passed “User” and I assume the reason for the error not finding the correct policy file.
Your error logs should have details of exactly what the error is, to help you diagnose the problem. Debugging should never be a matter of pure guesswork.