public function get_actions_tree_links()
 {
     $lang = LangLoader::get('common', 'web');
     $tree = new ModuleTreeLinks();
     $manage_categories_link = new AdminModuleLink(LangLoader::get_message('categories.manage', 'categories-common'), WebUrlBuilder::manage_categories());
     $manage_categories_link->add_sub_link(new AdminModuleLink(LangLoader::get_message('categories.manage', 'categories-common'), WebUrlBuilder::manage_categories()));
     $manage_categories_link->add_sub_link(new AdminModuleLink(LangLoader::get_message('category.add', 'categories-common'), WebUrlBuilder::add_category()));
     $tree->add_link($manage_categories_link);
     $manage_link = new AdminModuleLink($lang['web.manage'], WebUrlBuilder::manage());
     $manage_link->add_sub_link(new AdminModuleLink($lang['web.manage'], WebUrlBuilder::manage()));
     $manage_link->add_sub_link(new AdminModuleLink($lang['web.actions.add'], WebUrlBuilder::add(AppContext::get_request()->get_getint('id_category', Category::ROOT_CATEGORY))));
     $tree->add_link($manage_link);
     $tree->add_link(new AdminModuleLink(LangLoader::get_message('configuration', 'admin-common'), WebUrlBuilder::configuration()));
     if (!AppContext::get_current_user()->check_level(User::ADMIN_LEVEL)) {
         $tree->add_link(new ModuleLink($lang['web.actions.add'], WebUrlBuilder::add(AppContext::get_request()->get_getint('id_category', Category::ROOT_CATEGORY)), WebAuthorizationsService::check_authorizations()->write() || WebAuthorizationsService::check_authorizations()->contribution()));
     }
     $tree->add_link(new ModuleLink($lang['web.pending'], WebUrlBuilder::display_pending(), WebAuthorizationsService::check_authorizations()->write() || WebAuthorizationsService::check_authorizations()->contribution() || WebAuthorizationsService::check_authorizations()->moderation()));
     return $tree;
 }
 public function get_authorizations()
 {
     $authorizations = new CommentsAuthorizations();
     $authorizations->set_authorized_access_module(WebAuthorizationsService::check_authorizations($this->get_weblink()->get_id_category())->read());
     return $authorizations;
 }
 private function check_authorizations()
 {
     $weblink = $this->get_weblink();
     $not_authorized = !WebAuthorizationsService::check_authorizations($weblink->get_id_category())->moderation() && (!WebAuthorizationsService::check_authorizations($weblink->get_id_category())->write() && $weblink->get_author_user()->get_id() != AppContext::get_current_user()->get_id());
     switch ($weblink->get_approbation_type()) {
         case WebLink::APPROVAL_NOW:
             if (!WebAuthorizationsService::check_authorizations($weblink->get_id_category())->read() && $not_authorized) {
                 $error_controller = PHPBoostErrors::user_not_authorized();
                 DispatchManager::redirect($error_controller);
             }
             break;
         case WebLink::NOT_APPROVAL:
             if ($not_authorized) {
                 $error_controller = PHPBoostErrors::user_not_authorized();
                 DispatchManager::redirect($error_controller);
             }
             break;
         case WebLink::APPROVAL_DATE:
             if (!$weblink->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 is_contributor_member()
 {
     return !WebAuthorizationsService::check_authorizations()->write() && WebAuthorizationsService::check_authorizations()->contribution();
 }
 private function check_authorizations()
 {
     if (!WebAuthorizationsService::check_authorizations()->read()) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
 }
Example #6
0
 public function is_authorized_to_delete()
 {
     return WebAuthorizationsService::check_authorizations($this->id_category)->moderation() || (WebAuthorizationsService::check_authorizations($this->id_category)->write() || WebAuthorizationsService::check_authorizations($this->id_category)->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()
 {
     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_category_display_type() == WebConfig::DISPLAY_ALL_CONTENT) || !$this->config->are_descriptions_displayed_to_guests() && !WebAuthorizationsService::check_authorizations($this->get_category()->get_id())->read()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     } else {
         if (!WebAuthorizationsService::check_authorizations($this->get_category()->get_id())->read()) {
             $error_controller = PHPBoostErrors::user_not_authorized();
             DispatchManager::redirect($error_controller);
         }
     }
 }
 private function check_authorizations()
 {
     if (!(WebAuthorizationsService::check_authorizations()->write() || WebAuthorizationsService::check_authorizations()->contribution() || WebAuthorizationsService::check_authorizations()->moderation())) {
         $error_controller = PHPBoostErrors::user_not_authorized();
         DispatchManager::redirect($error_controller);
     }
 }
 public function is_displayed()
 {
     return WebAuthorizationsService::check_authorizations()->read();
 }