...Человеческий поиск в разработке...
- Модуль: bizproc
- Путь к файлу: ~/bitrix/modules/bizproc/classes/general/virtualdocument.php
- Класс: CBPVirtualDocument
- Вызов: CBPVirtualDocument::canUserOperateDocumentType
static function canUserOperateDocumentType($operation, $userId, $documentType, $arParameters = array()) { $documentType = trim($documentType); if ($documentType == '') return false; $userId = intval($userId); if (array_key_exists("UserIsAdmin", $arParameters)) { if ($arParameters["UserIsAdmin"] === true) return true; } else { $arGroups = CUser::GetUserGroup($userId); if (in_array(1, $arGroups)) return true; } if (!array_key_exists("AllUserGroups", $arParameters)) { if (!array_key_exists("UserGroups", $arParameters)) $arParameters["UserGroups"] = CUser::GetUserGroup($userId); $arParameters["AllUserGroups"] = $arParameters["UserGroups"]; $arParameters["AllUserGroups"][] = "author"; } if (!array_key_exists("DocumentStates", $arParameters)) { $arParameters["DocumentStates"] = CBPDocument::GetDocumentStates( array("bizproc", "CBPVirtualDocument", $documentType), null ); } if (array_key_exists("WorkflowId", $arParameters)) { if (array_key_exists($arParameters["WorkflowId"], $arParameters["DocumentStates"])) $arParameters["DocumentStates"] = array($arParameters["WorkflowId"] => $arParameters["DocumentStates"][$arParameters["WorkflowId"]]); else return false; } $arAllowableOperations = CBPDocument::GetAllowableOperations( $userId, $arParameters["AllUserGroups"], $arParameters["DocumentStates"] ); // $arAllowableOperations == null - workflow is not a statemachine // $arAllowableOperations == array() - no allowable operations // $arAllowableOperations == array("read", ...) - allowable operations list if (!is_array($arAllowableOperations) && $operation != 4) return true; if ($operation == 4) return true; $r = false; switch ($operation) { case 0: // DOCUMENT_OPERATION_VIEW_WORKFLOW $r = false; break; case 1: // DOCUMENT_OPERATION_START_WORKFLOW $r = in_array("create", $arAllowableOperations); break; case 4: // DOCUMENT_OPERATION_CREATE_WORKFLOW $r = false; break; case 2: // DOCUMENT_OPERATION_WRITE_DOCUMENT $r = in_array("create", $arAllowableOperations); break; case 3: // DOCUMENT_OPERATION_READ_DOCUMENT $r = false; break; default: $r = false; } return $r; }