mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 04:24:14 +09:00
isAccessible() 개선
This commit is contained in:
parent
be3e3cd4cb
commit
6bc8376435
2 changed files with 70 additions and 62 deletions
|
|
@ -17,7 +17,11 @@ class commentItem extends BaseObject
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
var $comment_srl = 0;
|
var $comment_srl = 0;
|
||||||
|
/**
|
||||||
|
* grant
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
var $grant_cache = null;
|
||||||
/**
|
/**
|
||||||
* Get the column list int the table
|
* Get the column list int the table
|
||||||
* @var array
|
* @var array
|
||||||
|
|
@ -88,44 +92,48 @@ class commentItem extends BaseObject
|
||||||
|
|
||||||
function isExists()
|
function isExists()
|
||||||
{
|
{
|
||||||
return $this->comment_srl ? TRUE : FALSE;
|
return (bool) $this->comment_srl;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isGranted()
|
function isGranted()
|
||||||
{
|
{
|
||||||
if($_SESSION['granted_comment'][$this->comment_srl])
|
if ($_SESSION['granted_comment'][$this->comment_srl])
|
||||||
{
|
{
|
||||||
return TRUE;
|
return $this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Context::get('is_logged'))
|
if ($this->grant_cache !== null)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return $this->grant_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->is_admin == 'Y')
|
if (!$logged_info->member_srl)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return $this->grant_cache = false;
|
||||||
|
}
|
||||||
|
if ($logged_info->is_admin == 'Y')
|
||||||
|
{
|
||||||
|
return $this->grant_cache = true;
|
||||||
|
}
|
||||||
|
if ($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl)
|
||||||
|
{
|
||||||
|
return $this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$grant = Context::get('grant');
|
$oModuleModel = getModel('module');
|
||||||
if($grant->manager)
|
$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
|
||||||
|
if ($grant->manager)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return $this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
|
return $this->grant_cache = false;
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setGrant()
|
function setGrant()
|
||||||
{
|
{
|
||||||
$this->is_granted = TRUE;
|
$this->grant_cache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setGrantForSession()
|
function setGrantForSession()
|
||||||
|
|
@ -134,6 +142,35 @@ class commentItem extends BaseObject
|
||||||
$this->setGrant();
|
$this->setGrant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isAccessible()
|
||||||
|
{
|
||||||
|
if ($_SESSION['accessible'][$this->comment_srl] === $this->get('last_update'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->get('status') == RX_STATUS_PUBLIC)
|
||||||
|
{
|
||||||
|
$this->setAccessible();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->isGranted())
|
||||||
|
{
|
||||||
|
$this->setAccessible();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oDocument = getModel('document')->getDocument($this->get('document_srl'));
|
||||||
|
if ($oDocument->isExists() && $oDocument->isGranted())
|
||||||
|
{
|
||||||
|
$this->setAccessible();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function setAccessible()
|
function setAccessible()
|
||||||
{
|
{
|
||||||
if(Context::getSessionStatus())
|
if(Context::getSessionStatus())
|
||||||
|
|
@ -144,16 +181,12 @@ class commentItem extends BaseObject
|
||||||
|
|
||||||
function isEditable()
|
function isEditable()
|
||||||
{
|
{
|
||||||
if($this->isGranted() || !$this->get('member_srl'))
|
return !$this->get('member_srl') || $this->isGranted();
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isSecret()
|
function isSecret()
|
||||||
{
|
{
|
||||||
return $this->get('is_secret') == 'Y' ? TRUE : FALSE;
|
return $this->get('is_secret') == 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
function isDeleted()
|
function isDeleted()
|
||||||
|
|
@ -166,33 +199,9 @@ class commentItem extends BaseObject
|
||||||
return $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
|
return $this->get('status') == RX_STATUS_DELETED_BY_ADMIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAccessible()
|
|
||||||
{
|
|
||||||
if (isset($_SESSION['accessible'][$this->comment_srl]) && $_SESSION['accessible'][$this->comment_srl] === $this->get('last_update'))
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->isSecret() || $this->isGranted())
|
|
||||||
{
|
|
||||||
$this->setAccessible();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
$oDocumentModel = getModel('document');
|
|
||||||
$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
|
|
||||||
if ($oDocument->isExists() && $oDocument->isGranted())
|
|
||||||
{
|
|
||||||
$this->setAccessible();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
function useNotify()
|
function useNotify()
|
||||||
{
|
{
|
||||||
return $this->get('notify_message') == 'Y' ? TRUE : FALSE;
|
return $this->get('notify_message') == 'Y';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -373,8 +373,7 @@ class document extends ModuleObject
|
||||||
*/
|
*/
|
||||||
function getConfigStatus($key)
|
function getConfigStatus($key)
|
||||||
{
|
{
|
||||||
if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
|
return $this->statusList[$key];
|
||||||
else $this->getDefaultStatus();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* End of file document.class.php */
|
/* End of file document.class.php */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue