Skip to content

Instantly share code, notes, and snippets.

@lorenzo
Created July 23, 2015 13:35
Show Gist options
  • Save lorenzo/81609897c1f3a7cb4e95 to your computer and use it in GitHub Desktop.
Save lorenzo/81609897c1f3a7cb4e95 to your computer and use it in GitHub Desktop.
<?php
/**
* Configures authentication and the basic fields to show on each screen
*
* @param Event $event The given event
* @return void
*/
public function beforeFilter(Event $event)
{
if ($this->request->public) {
$this->Auth->allow();
}
parent::beforeFilter($event);
// Attach an event listener to the main model
$this->loadModel()
->eventManager()
->on(new RequestMetadata($this->request, $this->Auth->user('username')));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment