17 $complexDocumentId =
null;
18 $complexDocumentType =
null;
20 if (isset(
$options[
'signedDocument']) && is_string(
$options[
'signedDocument']))
22 $unsignedDocument = \CBPDocument::unSignParameters(
$options[
'signedDocument']);
23 if (!empty($unsignedDocument) && count($unsignedDocument) === 2)
27 $complexDocumentType = \CBPHelper::parseDocumentId($unsignedDocument[0]);
28 $complexDocumentId = \CBPHelper::parseDocumentId(
29 [$complexDocumentType[0], $complexDocumentType[1], $unsignedDocument[1]]
32 catch (\CBPArgumentNullException $e)
37 $options[
'complexDocumentId'] = $complexDocumentId;
38 $options[
'complexDocumentType'] = $complexDocumentType;
46 return $this->hasRights();
56 return $this->hasRights();
61 return $this->hasRights();
69 return $this->hasRights();
72 private function hasRights(): bool
75 'complexDocumentId' => $complexDocumentId,
76 'complexDocumentType' => $complexDocumentType,
77 'templateId' => $templateId
80 if ($templateId <= 0 || !is_array($complexDocumentType))
85 $currentUser = CurrentUser::get();
86 $currentUserId = (int)$currentUser->getId();
88 if ($currentUserId > 0)
90 if ($complexDocumentId)
92 return \CBPDocument::canUserOperateDocument(
93 \CBPCanUserOperateOperation::StartWorkflow,
97 'UserGroups' => \CUser::GetUserGroup($currentUserId),
98 'DocumentStates' => \CBPDocument::getActiveStates($complexDocumentId),
99 'WorkflowTemplateId' => $templateId,
104 return \CBPDocument::canUserOperateDocumentType(
105 \CBPCanUserOperateOperation::StartWorkflow,
107 $complexDocumentType,
109 'UserGroups' => \CUser::GetUserGroup($currentUserId),
110 'DocumentStates' => \CBPDocument::getDocumentStates($complexDocumentType, $complexDocumentId),
111 'WorkflowTemplateId' => $templateId,