public function is_displayed()
 {
     return !Url::is_current_url('/guestbook/') && GuestbookAuthorizationsService::check_authorizations()->read();
 }
 private function check_authorizations()
 {
     $message = $this->get_message();
     if ($message->get_id() === null) {
         if (!GuestbookAuthorizationsService::check_authorizations()->write()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     } else {
         if (!$message->is_authorized_edit()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     }
     if (AppContext::get_current_user()->is_readonly()) {
         $controller = PHPBoostErrors::user_in_read_only();
         DispatchManager::redirect($controller);
     }
 }
 private function check_authorizations()
 {
     if (!GuestbookAuthorizationsService::check_authorizations()->read()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
 }
 public function is_authorized_delete()
 {
     return GuestbookAuthorizationsService::check_authorizations()->moderation() || GuestbookAuthorizationsService::check_authorizations()->write() && $this->get_author_user()->get_id() == AppContext::get_current_user()->get_id() && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL);
 }