- Модуль: forum
- Путь к файлу: ~/bitrix/modules/forum/lib/comments/workflowentity.php
- Класс: BitrixForumCommentsWorkflowEntity
- Вызов: WorkflowEntity::checkHasAccess
private function checkHasAccess($userId)
{
global $USER;
if($this->hasAccess === null)
{
if (Loader::includeModule("bizproc"))
{
if(
$USER->isAdmin()
|| $USER->canDoOperation('bitrix24_config')
)
{
$this->hasAccess = true;
}
else
{
$workflowId = false;
$workflowIntegerId = intval($this->getId());
if ($workflowIntegerId > 0)
{
$workflowId = CBPStateService::getWorkflowByIntegerId($workflowIntegerId);
}
if ($workflowId)
{
$currentUserId = (int) $USER->getId();
$participants = CBPTaskService::getWorkflowParticipants($workflowId);
if (in_array($currentUserId, $participants))
{
$this->hasAccess = true;
}
else
{
$state = CBPStateService::getWorkflowStateInfo($workflowId);
$this->hasAccess = (
$state
&& $currentUserId === (int) $state['STARTED_BY']
);
}
}
else
{
$this->hasAccess = false;
}
if (!$this->hasAccess && Loader::includeModule("iblock"))
{
$documentId = CBPStateService::GetStateDocumentId($workflowId);
$elementQuery = CIBlockElement::getList(
array(), array("ID" => $documentId[2]), false, false, array("IBLOCK_ID"));
$element = $elementQuery->fetch();
if ($element['IBLOCK_ID'])
{
$this->hasAccess = CIBlockElementRights::userHasRightTo(
$element["IBLOCK_ID"], $documentId[2], "element_read");
}
}
}
}
else
{
$this->hasAccess = false;
}
}
return $this->hasAccess;
}