I'm sorry for being such a dumb ass. I'm following a tutorial to add admin routing to my cakephp application that I'm trying to create as a learning exercise.
The tutorial isn't hugely well explained (I think I'm just too much of a beginner in reality) and I don't understand the following, could anyone please tell me in english what is happening here.
public function isAuthorized() {
$role = $this->Auth->user('role');
$neededRole = null;
$prefix = !empty($this->params['prefix']) ? $this->params['prefix'] : null;
if (!empty($prefix) && in_array($prefix, Configure::read('Routing.prefixes'))) {
$neededRole = $prefix;
}
return (empty($neededRole) || strcasecmp($role, 'admin') == 0 || strcasecmp($role, $neededRole) == 0);
}