/**
  * Sets up a before filter which authorizes the resource using the instance variable.
  * For example, if you have an ArticlesController it will check the $this->article instance variable
  * and ensure the user can perform the current action on it. Under the hood it is doing
  * something like the following.
  *
  *   $this->authorize($this->params['action'], $this->article ?: 'Article')
  *
  * Call this method directly on the controller class.
  *
  *   class BooksController extends Controller
  *   {
  *       public function __construct()
  *       {
  *           $this->authorizeResource();
  *       }
  *   }
  *
  * If you pass in the name of a resource which does not match the controller it will assume
  * it is a parent resource.
  *
  *   class BooksController extends Controller
  *   {
  *       public function __construct()
  *       {
  *           $this->authorizeResource('author');
  *           $this->authorizeResource('book');
  *       }
  *   }
  *
  * Here it will authorize '<code>show</code>', <code>$this->author</code> on every action before authorizing the book.
  *
  * That first argument is optional and will default to the singular name of the controller.
  * A hash of options (see below) can also be passed to this method to further customize it.
  *
  * See loadAndAuthorizeResource() to automatically load the resource too.
  *
  * Options:
  * ['<code>only</code>']
  *   Only applies before filter to given actions.
  *
  * ['<code>except</code>']
  *   Does not apply before filter to given actions.
  *
  * ['<code>singleton</code>']
  *   Pass <code>true</code> if this is a singleton resource through a <code>hasOne</code> association.
  *
  * ['<code>parent</code>']
  *   True or false depending on if the resource is considered a parent resource. This defaults to <code>true</code> if a resource
  *   name is given which does not match the controller.
  *
  * ['<code>class</code>']
  *   The class to use for the model (string). This passed in when the instance variable is not set.
  *   Pass <code>false</code> if there is no associated class for this resource and it will use a symbol of the resource name.
  *
  * ['<code>instance_name</code>']
  *   The name of the instance variable for this resource.
  *
  * ['<code>through</code>']
  *   Authorize conditions on this parent resource when instance isn't available.
  *
  * ['<code>prepend</code>']
  *   Passing <code>true</code> will use prependBeforeFilter() instead of a normal beforeFilter().
  *
  */
 public function authorizeResource($args = null)
 {
     $args = is_array($args) ? $args : func_get_args();
     ControllerResource::addBeforeFilter($this, __METHOD__, $args);
 }