1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
faces.php
См. документацию.
1<?php
2
3namespace Bitrix\Bizproc\Controller\Workflow;
4
5use Bitrix\Bizproc;
6use Bitrix\Bizproc\UI\WorkflowFacesView;
7use Bitrix\Main\Localization\Loc;
8
10{
11 public function loadAction(string $workflowId, int $userId, int $runningTaskId = 0): ?WorkflowFacesView
12 {
13 if (empty($workflowId))
14 {
15 $this->addError(new Bizproc\Error('empty workflow id'));
16
17 return null;
18 }
19
20 if ($runningTaskId < 0)
21 {
22 $this->addError(new Bizproc\Error('negative running task id'));
23
24 return null;
25 }
26
27 $currentUserId = (int)($this->getCurrentUser()?->getId() ?? 0); // $this->getCurrentUser()->getId() return string
28
29 $accessService = new Bizproc\Api\Service\WorkflowAccessService();
30 $canViewFacesResponse = $accessService->canViewFaces(
31 new Bizproc\Api\Request\WorkflowAccessService\CanViewFacesRequest($workflowId, $userId, $currentUserId)
32 );
33
34 if ($canViewFacesResponse->isSuccess())
35 {
36 return $this->getWorkflowFaces($workflowId, $runningTaskId);
37 }
38
39 $this->addError(
40 new Bizproc\Error(
41 Loc::getMessage('BIZPROC_CONTROLLER_WORKFLOW_FACES_CAN_READ_ERROR'), 'ACCESS_DENIED'
42 )
43 );
44
45 return null;
46 }
47
48 private function getWorkflowFaces(string $workflowId, int $runningTaskId): WorkflowFacesView
49 {
50 return new WorkflowFacesView($workflowId, $runningTaskId === 0 ? null : $runningTaskId);
51 }
52}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static addError($error)
Определения base.php:278
loadAction(string $workflowId, int $userId, int $runningTaskId=0)
Определения faces.php:11
Определения error.php:15
Определения request.php:10