function CanUserOperateDocument($operation, $userId, $documentId, $arParameters = array()) { if (CWikiSocnet::IsSocNet()) { return CWikiUtils::CheckAccess('write'); } else { return parent::CanUserOperateDocument($operation, $userId, $documentId, $arParameters); } }
$bPermissions = false; //delete and modify can: if($bWorkFlow) { //For delete action we have to check all statuses in element history $STATUS_PERMISSION = CIBlockElement::WF_GetStatusPermission($arRes["WF_STATUS_ID"], $_REQUEST['action']=="delete"? $ID: false); if($STATUS_PERMISSION >= 2) $bPermissions = true; } elseif ($bBizproc) { $bCanWrite = CIBlockDocument::CanUserOperateDocument( CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), $ID, array( "IBlockId" => $IBLOCK_ID, 'IBlockRightsMode' => $arIBlock['RIGHTS_MODE'], 'UserGroups' => $USER->GetUserGroupArray(), ) ); if ($bCanWrite) $bPermissions = true; } else { $bPermissions = true; } if(!$bPermissions)
); */ if (isset($arElementOps[$f_ID]) && isset($arElementOps[$f_ID]["element_delete"]) && 2 <= $STATUS_PERMISSION) { if (!isset($arElementOps[$f_ID]["element_edit_any_wf_status"])) { $intMinPerm = CIBlockElement::WF_GetStatusPermission($row->arRes["WF_STATUS_ID"], $f_ID); } if (2 <= $intMinPerm) { if (!empty($arActions)) { $arActions[] = array("SEPARATOR" => true); } $arActions[] = array("ICON" => "delete", "TEXT" => GetMessage('MAIN_DELETE'), "TITLE" => GetMessage("IBLOCK_DELETE_ALT"), "ACTION" => "if (confirm('" . GetMessageJS('IBLOCK_CONFIRM_DEL_MESSAGE') . "')) " . $lAdmin->ActionDoGroup($row->arRes['orig']['ID'], "delete", $sThisSectionUrl)); } } } } elseif ($boolSubBizproc) { $bWritePermission = CIBlockDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), $f_ID, array("IBlockId" => $intSubIBlockID, "AllUserGroups" => $row->arRes["CURRENT_USER_GROUPS"], "DocumentStates" => $arDocumentStates)); $bStartWorkflowPermission = CIBlockDocument::CanUserOperateDocument(CBPCanUserOperateOperation::StartWorkflow, $USER->GetID(), $f_ID, array("IBlockId" => $intSubIBlockID, "AllUserGroups" => $row->arRes["CURRENT_USER_GROUPS"], "DocumentStates" => $arDocumentStates)); /* if ( $bStartWorkflowPermission || ( isset($arElementOps[$f_ID]) && isset($arElementOps[$f_ID]["element_bizproc_start"]) ) ) { $arActions[] = array( "ICON" => "", "TEXT" => GetMessage("IBEL_A_BP_RUN"), "ACTION" => $lAdmin->ActionRedirect('iblock_start_bizproc.php?document_id='.$f_ID.'&document_type=iblock_'.$IBLOCK_ID.'&back_url='.urlencode($APPLICATION->GetCurPageParam("", array("mode", "table_id"))).''), ); } */ if ($row->arRes['lockStatus'] == "red") {
$arArrays = array(); $arElements = array(); $arSections = array(); $CURRENT_USER_ID = $GLOBALS["USER"]->GetID(); $CURRENT_USER_GROUPS = $GLOBALS["USER"]->GetUserGroupArray(); foreach ($arResult["ELEMENTS_ROWS"] as $i => $arRow) { if ($arResult["BIZPROC"] == "Y") { $arDocumentStates = CBPDocument::GetDocumentStates(array("iblock", "CIBlockDocument", "iblock_" . $arResult["IBLOCK_ID"]), array("iblock", "CIBlockDocument", $arRow["data"]["ID"])); $USER_GROUPS = $CURRENT_USER_GROUPS; if ($arRow["data"]["~CREATED_BY"] == $CURRENT_USER_ID) { $USER_GROUPS[] = "Author"; } $ii = 0; $html = ""; foreach ($arDocumentStates as $kk => $vv) { $canViewWorkflow = CIBlockDocument::CanUserOperateDocument(CBPCanUserOperateOperation::ViewWorkflow, $CURRENT_USER_ID, $arRow["data"]["ID"], array("IBlockPermission" => $arResult["IBLOCK_PERM"], "AllUserGroups" => $USER_GROUPS, "DocumentStates" => $arDocumentStates, "WorkflowId" => $kk)); if (!$canViewWorkflow) { continue; } if (strlen($vv["TEMPLATE_NAME"]) > 0) { $html .= "<b>" . $vv["TEMPLATE_NAME"] . "</b>:<br />"; } else { $html .= "<b>" . ++$ii . "</b>:<br />"; } $url = str_replace(array("#list_id#", "#document_state_id#", "#group_id#"), array($arResult["IBLOCK_ID"], $vv["ID"], $arParams["SOCNET_GROUP_ID"]), $arParams["~BIZPROC_LOG_URL"]); $html .= "<a href=\"" . htmlspecialcharsbx($url) . "\">" . (strlen($vv["STATE_TITLE"]) > 0 ? $vv["STATE_TITLE"] : $vv["STATE_NAME"]) . "</a><br />"; } $arRow["data"]["BIZPROC"] = $html; } foreach ($arRow["data"] as $FIELD_ID => $value) { $arField = $arResult["FIELDS"][$FIELD_ID];