private function check_authorizations()
 {
     if (!NewsAuthorizationsService::check_authorizations()->read()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
 }
 private function is_contributor_member()
 {
     return !NewsAuthorizationsService::check_authorizations()->write() && NewsAuthorizationsService::check_authorizations()->contribution();
 }
 private function check_authorizations()
 {
     if (!(NewsAuthorizationsService::check_authorizations()->write() || NewsAuthorizationsService::check_authorizations()->contribution() || NewsAuthorizationsService::check_authorizations()->moderation())) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
 }
 public function get_authorizations()
 {
     $authorizations = new CommentsAuthorizations();
     $authorizations->set_authorized_access_module(NewsAuthorizationsService::check_authorizations($this->get_news()->get_id_cat())->read());
     return $authorizations;
 }
Exemple #5
0
 public function is_authorized_to_delete()
 {
     return NewsAuthorizationsService::check_authorizations($this->id_cat)->moderation() || (NewsAuthorizationsService::check_authorizations($this->get_id_cat())->write() || NewsAuthorizationsService::check_authorizations($this->get_id_cat())->contribution() && !$this->is_visible()) && $this->get_author_user()->get_id() == AppContext::get_current_user()->get_id() && AppContext::get_current_user()->check_level(User::MEMBER_LEVEL);
 }
 private function check_authorizations()
 {
     $news = $this->get_news();
     $not_authorized = !NewsAuthorizationsService::check_authorizations($news->get_id_cat())->moderation() && (!NewsAuthorizationsService::check_authorizations($news->get_id_cat())->write() && $news->get_author_user()->get_id() != AppContext::get_current_user()->get_id());
     switch ($news->get_approbation_type()) {
         case News::APPROVAL_NOW:
             if (!NewsAuthorizationsService::check_authorizations($news->get_id_cat())->read() && $not_authorized) {
                 $error_controller = PHPBoostErrors::user_not_authorized();
                 DispatchManager::redirect($error_controller);
             }
             break;
         case News::NOT_APPROVAL:
             if ($not_authorized) {
                 $error_controller = PHPBoostErrors::user_not_authorized();
                 DispatchManager::redirect($error_controller);
             }
             break;
         case News::APPROVAL_DATE:
             if (!$news->is_visible() && $not_authorized) {
                 $error_controller = PHPBoostErrors::user_not_authorized();
                 DispatchManager::redirect($error_controller);
             }
             break;
         default:
             $error_controller = PHPBoostErrors::unexisting_page();
             DispatchManager::redirect($error_controller);
             break;
     }
 }
 private function check_authorizations()
 {
     if (AppContext::get_current_user()->is_guest()) {
         if ($this->config->are_descriptions_displayed_to_guests() && (!Authorizations::check_auth(RANK_TYPE, User::MEMBER_LEVEL, $this->get_category()->get_authorizations(), Category::READ_AUTHORIZATIONS) || !$this->config->get_display_condensed_enabled()) || !$this->config->are_descriptions_displayed_to_guests() && !NewsAuthorizationsService::check_authorizations($this->get_category()->get_id())->read()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     } else {
         if (!NewsAuthorizationsService::check_authorizations($this->get_category()->get_id())->read()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     }
 }