19 $fields = $this->
getAction()->getArguments()[
'fields'];
20 $avatarId = $fields[
'avatar'] ??
null;
21 if (!is_numeric($avatarId))
26 $avatarResult = \CFile::GetByID($avatarId);
27 $avatar = (isset($avatarResult) && $avatarResult) ? $avatarResult->Fetch() :
null;
28 $info = (
new Image($_SERVER[
"DOCUMENT_ROOT"] . $avatar[
'SRC']))->getInfo();
35 return new EventResult(EventResult::ERROR,
null,
null, $this);
38 $currentUser = $this->
getAction()->getCurrentUser();
39 $userId = isset($currentUser) ? $currentUser->getId() :
null;
40 $securityContext =
new DiskSecurityContext((
int)$userId);
42 'filter' => [
'FILE_ID' => $avatarId],
43 'with' => [
'CREATE_USER']
45 $parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, [
'ID',
'CREATED_BY']);
47 $fileCollection = File::getModelList($parameters);
51 'File is not accessible',
54 return new EventResult(EventResult::ERROR,
null,
null, $this);