diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php index 571dfa7f9..3557d7d7d 100644 --- a/modules/board/board.controller.php +++ b/modules/board/board.controller.php @@ -62,6 +62,34 @@ class BoardController extends Board throw new Rhymix\Framework\Exception('msg_content_too_long'); } + // Check category + $category_list = DocumentModel::getCategoryList($this->module_srl); + if (count($category_list) > 0) + { + if ($obj->category_srl) + { + if (isset($category_list[$obj->category_srl])) + { + if (!$category_list[$obj->category_srl]->grant) + { + return new BaseObject(-1, 'msg_not_permitted'); + } + } + else + { + $obj->category_srl = 0; + } + } + if (!$obj->category_srl && ($this->module_info->allow_no_category ?? 'N') !== 'Y') + { + if (!$this->grant->manager) + { + throw new Rhymix\Framework\Exception('categoryneeded'); + } + } + } + + // unset document style if not manager if(!$this->grant->manager) { diff --git a/modules/board/board.view.php b/modules/board/board.view.php index 53ef44565..f811d7f44 100644 --- a/modules/board/board.view.php +++ b/modules/board/board.view.php @@ -926,7 +926,7 @@ class BoardView extends Board /** * add JS filters **/ - if(Context::get('logged_info')->is_admin == 'Y' || $this->module_info->allow_no_category == 'Y') + if($this->grant->manager || $this->module_info->allow_no_category == 'Y') { Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); }