servermgrv2 init...

This commit is contained in:
최준흠git config git config --helpgit config --global user.name 최준흠 2023-08-05 16:39:57 +09:00
parent df243cec35
commit 783c3699ca
3 changed files with 25 additions and 1 deletions

View File

@ -629,13 +629,18 @@ abstract class BaseController extends Controller
}
}
//File Download관련
final public function download(string $field, $uid)
public function download_process($entity)
{
return $entity;
}
public function download(string $field, $uid)
{
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
if (!$entity->$field) {
throw new \Exception("첨부파일이 확인되지 않습니다.");
}
$entity = $this->download_process($entity);
list($origin_filename, $filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
if (is_file(WRITEPATH . PATHS['UPLOAD'] . "/" . $origin_filename)) {
throw new \Exception("파일이 확인되지 않습니다.");

View File

@ -20,6 +20,12 @@ class BoardController extends FrontController
public function getFields(string $action = ""): array
{
$fields = ['title', "board_file", "passwd", "content"];
try {
//권한체크
$this->isRole('upload');
} catch (\Exception $e) {
$fields = ['title', "passwd", "content"];
}
switch ($action) {
case "index":
case "excel":
@ -132,4 +138,11 @@ class BoardController extends FrontController
$this->_model->where("status", DEFAULTS['STATUS']);
parent::index_setCondition();
}
//Download관련
public function download_process($entity)
{
//권한체크
$this->isRole('download');
return $entity;
}
}

View File

@ -39,6 +39,12 @@ abstract class FrontController extends BaseController
case 'view':
$category_field = CATEGORY_ROLE_FIELDS['READ'];
break;
case 'upload':
$category_field = CATEGORY_ROLE_FIELDS['UPLOAD'];
break;
case 'download':
$category_field = CATEGORY_ROLE_FIELDS['DONWLOAD'];
break;
default:
$category_field = CATEGORY_ROLE_FIELDS['ACCESS'];
break;