This is the code of class RequestPolicy:
<?php
namespace App\Policy;
use Authorization\Policy\RequestPolicyInterface;
use Cake\Http\ServerRequest;
class RequestPolicy implements RequestPolicyInterface
{
/**
* Method to check if the request can be accessed
*
* @param \Authorization\IdentityInterface|null $identity Identity
* @param \Cake\Http\ServerRequest $request Server Request
* @return bool
*/
public function canAccess($identity, ServerRequest $request)
{
if (($request->getParam('controller') === 'Users' && $request->getParam('action') === 'login') ||
($request->getParam('controller') === 'Profiles' && $request->getParam('action') === 'add') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'add') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'forgotpassword') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'resetpassword') ||
(!empty($identity) && (($request->getParam('controller') === 'Home' && $request->getParam('action') === 'index') ||
($request->getParam('controller') === 'Careers' && $request->getParam('action') === 'add') ||
($request->getParam('controller') === 'Careers' && $request->getParam('action') === 'edit') ||
($request->getParam('controller') === 'Careers' && $request->getParam('action') === 'index') ||
($request->getParam('controller') === 'Careers' && $request->getParam('action') === 'view') ||
($request->getParam('controller') === 'Careers' && $request->getParam('action') === 'delete') ||
($request->getParam('controller') === 'Profiles' && $request->getParam('action') === 'edit') ||
($request->getParam('controller') === 'Profiles' && $request->getParam('action') === 'index') ||
($request->getParam('controller') === 'Profiles' && $request->getParam('action') === 'view') ||
($request->getParam('controller') === 'Profiles' && $request->getParam('action') === 'delete') ||
($request->getParam('controller') === 'Routes' && $request->getParam('action') === 'add') ||
($request->getParam('controller') === 'Routes' && $request->getParam('action') === 'edit') ||
($request->getParam('controller') === 'Routes' && $request->getParam('action') === 'index') ||
($request->getParam('controller') === 'Routes' && $request->getParam('action') === 'view') ||
($request->getParam('controller') === 'Routes' && $request->getParam('action') === 'delete') ||
($request->getParam('controller') === 'RoutesSubjects' && $request->getParam('action') === 'add') ||
($request->getParam('controller') === 'RoutesSubjects' && $request->getParam('action') === 'edit') ||
($request->getParam('controller') === 'RoutesSubjects' && $request->getParam('action') === 'index') ||
($request->getParam('controller') === 'RoutesSubjects' && $request->getParam('action') === 'view') ||
($request->getParam('controller') === 'RoutesSubjects' && $request->getParam('action') === 'delete') ||
($request->getParam('controller') === 'Subjects' && $request->getParam('action') === 'add') ||
($request->getParam('controller') === 'Subjects' && $request->getParam('action') === 'edit') ||
($request->getParam('controller') === 'Subjects' && $request->getParam('action') === 'index') ||
($request->getParam('controller') === 'Subjects' && $request->getParam('action') === 'view') ||
($request->getParam('controller') === 'Subjects' && $request->getParam('action') === 'delete') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'changepassword') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'edit') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'index') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'view') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'delete') ||
($request->getParam('controller') === 'Users' && $request->getParam('action') === 'logout')))
) {
return true;
}
return false;
}
}
?>
Can you tell me why is this returning false?