mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Replace $oDocument with empty DocumentItem if access is not allowed
This commit is contained in:
parent
4fe87edd1d
commit
8b8dc99431
2 changed files with 27 additions and 10 deletions
|
|
@ -56,6 +56,8 @@ class BoardAPI extends Board
|
||||||
public function dispBoardContentView($oModule)
|
public function dispBoardContentView($oModule)
|
||||||
{
|
{
|
||||||
$oDocument = Context::get('oDocument');
|
$oDocument = Context::get('oDocument');
|
||||||
|
if ($oDocument->isExists() && $oDocument->isAccessible())
|
||||||
|
{
|
||||||
if ($oDocument->isGranted())
|
if ($oDocument->isGranted())
|
||||||
{
|
{
|
||||||
$extra_vars = $oDocument->getExtraVars() ?: [];
|
$extra_vars = $oDocument->getExtraVars() ?: [];
|
||||||
|
|
@ -63,6 +65,11 @@ class BoardAPI extends Board
|
||||||
}
|
}
|
||||||
$oModule->add('oDocument', $this->_arrangeContent($oDocument, $oModule->grant));
|
$oModule->add('oDocument', $this->_arrangeContent($oDocument, $oModule->grant));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oModule->add('oDocument', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief contents file list
|
* @brief contents file list
|
||||||
|
|
@ -70,13 +77,13 @@ class BoardAPI extends Board
|
||||||
public function dispBoardContentFileList($oModule)
|
public function dispBoardContentFileList($oModule)
|
||||||
{
|
{
|
||||||
$oDocument = Context::get('oDocument');
|
$oDocument = Context::get('oDocument');
|
||||||
if($oDocument->isAccessible())
|
if ($oDocument->isExists() && $oDocument->isAccessible())
|
||||||
{
|
{
|
||||||
$oModule->add('file_list', $this->_arrangeFiles(Context::get('file_list') ?: []));
|
$oModule->add('file_list', $this->_arrangeFiles(Context::get('file_list') ?: []));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$oModule->add('file_list', array());
|
$oModule->add('file_list', []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,6 +99,9 @@ class BoardAPI extends Board
|
||||||
* @brief comments list
|
* @brief comments list
|
||||||
**/
|
**/
|
||||||
public function dispBoardContentCommentList($oModule)
|
public function dispBoardContentCommentList($oModule)
|
||||||
|
{
|
||||||
|
$oDocument = Context::get('oDocument');
|
||||||
|
if ($oDocument->isExists() && $oDocument->isAccessible())
|
||||||
{
|
{
|
||||||
$comment_list = Context::get('comment_list');
|
$comment_list = Context::get('comment_list');
|
||||||
if (!is_array($comment_list))
|
if (!is_array($comment_list))
|
||||||
|
|
@ -100,6 +110,11 @@ class BoardAPI extends Board
|
||||||
}
|
}
|
||||||
$oModule->add('comment_list', $this->_arrangeComments($comment_list));
|
$oModule->add('comment_list', $this->_arrangeComments($comment_list));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oModule->add('comment_list', []);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply _arrangeContent to a list of documents.
|
* Apply _arrangeContent to a list of documents.
|
||||||
|
|
|
||||||
|
|
@ -318,6 +318,7 @@ class BoardView extends Board
|
||||||
{
|
{
|
||||||
if (abs($oDocument->get('member_srl')) != $this->user->member_srl)
|
if (abs($oDocument->get('member_srl')) != $this->user->member_srl)
|
||||||
{
|
{
|
||||||
|
$oDocument = DocumentModel::getDocument(0);
|
||||||
Context::set('document_srl', null, true);
|
Context::set('document_srl', null, true);
|
||||||
$this->dispBoardMessage('msg_not_founded', 404);
|
$this->dispBoardMessage('msg_not_founded', 404);
|
||||||
}
|
}
|
||||||
|
|
@ -326,6 +327,7 @@ class BoardView extends Board
|
||||||
// if the document is TEMP saved, pretend that it doesn't exist.
|
// if the document is TEMP saved, pretend that it doesn't exist.
|
||||||
if($oDocument->getStatus() == 'TEMP')
|
if($oDocument->getStatus() == 'TEMP')
|
||||||
{
|
{
|
||||||
|
$oDocument = DocumentModel::getDocument(0);
|
||||||
Context::set('document_srl', null, true);
|
Context::set('document_srl', null, true);
|
||||||
$this->dispBoardMessage('msg_not_founded', 404);
|
$this->dispBoardMessage('msg_not_founded', 404);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue