Esempio n. 1
0
 /**
  * Determine if the given user has access to the view. Note that
  * this sets the display handler if it hasn't been.
  */
 public function access($displays = NULL, $account = NULL)
 {
     // No one should have access to disabled views.
     if (!$this->storage->status()) {
         return FALSE;
     }
     if (!isset($this->current_display)) {
         $this->initDisplay();
     }
     if (!$account) {
         $account = $this->user;
     }
     // We can't use choose_display() here because that function
     // calls this one.
     $displays = (array) $displays;
     foreach ($displays as $display_id) {
         if ($this->displayHandlers->has($display_id)) {
             if (($display = $this->displayHandlers->get($display_id)) && $display->access($account)) {
                 return TRUE;
             }
         }
     }
     return FALSE;
 }