mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Add an option to check the permissions of modules linked to documents or comments
This commit is contained in:
parent
7c963d0ac3
commit
0dd567bc00
3 changed files with 21 additions and 3 deletions
|
|
@ -188,13 +188,22 @@ class commentItem extends BaseObject
|
|||
}
|
||||
}
|
||||
|
||||
function isAccessible()
|
||||
function isAccessible($strict = false)
|
||||
{
|
||||
if(!$this->isExists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($strict)
|
||||
{
|
||||
$grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), Context::get('logged_info'));
|
||||
if (isset($grant->list) && isset($grant->view) && ($grant->list !== true || $grant->view !== true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['accessible'][$this->comment_srl]) && $_SESSION['accessible'][$this->comment_srl] === $this->get('last_update'))
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -237,13 +237,22 @@ class documentItem extends BaseObject
|
|||
$this->setGrant();
|
||||
}
|
||||
|
||||
function isAccessible()
|
||||
function isAccessible($strict = false)
|
||||
{
|
||||
if(!$this->isExists())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($strict)
|
||||
{
|
||||
$grant = ModuleModel::getGrant(ModuleModel::getModuleInfoByModuleSrl($this->get('module_srl')), Context::get('logged_info'));
|
||||
if (isset($grant->list) && isset($grant->view) && ($grant->list !== true || $grant->view !== true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['accessible'][$this->document_srl]) && $_SESSION['accessible'][$this->document_srl] === $this->get('last_update'))
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class documentView extends document
|
|||
$oDocument = DocumentModel::getDocument($document_srl);
|
||||
if(!$oDocument->isExists()) throw new Rhymix\Framework\Exceptions\TargetNotFound;
|
||||
// Check permissions
|
||||
if(!$oDocument->isAccessible()) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
if(!$oDocument->isAccessible(true)) throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
// Information setting module
|
||||
//Context::set('module_info', $module_info); //module_info not use in UI
|
||||
// Browser title settings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue