Add option to disable admin content protection

최고관리자의 글을 게시판 관리자가 수정/삭제하지 못하도록 하는 기능은
게시판을 위키 등 협업 용도로 사용하는 경우 불편을 유발할 수 있으므로
옵션으로 켜고 끌 수 있도록 합니다. 기본값은 수정/삭제 금지입니다.
This commit is contained in:
Kijin Sung 2021-12-30 23:55:10 +09:00
parent 9d6e54f2f6
commit 3925c24487
9 changed files with 95 additions and 36 deletions

View file

@ -127,10 +127,13 @@ class boardController extends board
}
// Protect admin document
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
if ($this->module_info->protect_admin_content_update !== 'N')
{
throw new Rhymix\Framework\Exception('msg_admin_document_no_modify');
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
throw new Rhymix\Framework\Exception('msg_admin_document_no_modify');
}
}
// if document status is temp
@ -327,6 +330,15 @@ class boardController extends board
}
}
if ($this->module_info->protect_admin_content_delete !== 'N' && $this->user->is_admin !== 'Y')
{
$member_info = MemberModel::getMemberInfo($oDocument->get('member_srl'));
if($member_info->is_admin === 'Y')
{
return new BaseObject(-1, 'document.msg_document_is_admin_not_permitted');
}
}
if($this->module_info->protect_document_regdate > 0 && $this->grant->manager == false)
{
if($oDocument->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))
@ -473,10 +485,13 @@ class boardController extends board
}
}
$member_info = MemberModel::getMemberInfo($comment->member_srl);
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
if ($this->module_info->protect_admin_content_update !== 'N')
{
throw new Rhymix\Framework\Exception('msg_admin_comment_no_modify');
$member_info = MemberModel::getMemberInfo($comment->member_srl);
if($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y')
{
throw new Rhymix\Framework\Exception('msg_admin_comment_no_modify');
}
}
// INSERT if comment_srl does not exist.
@ -582,6 +597,15 @@ class boardController extends board
}
}
if ($this->module_info->protect_admin_content_delete !== 'N' && $this->user->is_admin !== 'Y')
{
$member_info = MemberModel::getMemberInfo($comment->get('member_srl'));
if($member_info->is_admin === 'Y')
{
return new BaseObject(-1, 'comment.msg_admin_comment_no_delete');
}
}
if($this->module_info->protect_comment_regdate > 0 && $this->grant->manager == false)
{
if($comment->get('regdate') < date('YmdHis', strtotime('-'.$this->module_info->protect_document_regdate.' day')))