19 private $allowEntityList = [
23 private $entityScope = [
27 public function getAction($entity, $id, $field, $value, \CRestServer $restServer =
null)
30 if (in_array($entity, $this->allowEntityList,
true))
32 if ($restServer && $this->entityScope[$entity])
34 $authScope = $restServer->getAuthScope();
35 if (!in_array($this->entityScope[$entity], $authScope,
true))
39 new Error(
'Invalid request credentials',
'INVALID_CREDENTIALS')
47 global $USER_FIELD_MANAGER;
48 $userFieldsData = $USER_FIELD_MANAGER->getUserFields($entity, (
int) $id, LANGUAGE_ID);
51 $userFieldsData[$field][
'USER_TYPE_ID'] ===
'file'
53 && !empty($userFieldsData[$field][
'VALUE']))
56 (
int) $value === (
int) $userFieldsData[$field][
'VALUE']
58 is_array($userFieldsData[$field][
'VALUE'])
59 && in_array((
int) $value, $userFieldsData[$field][
'VALUE'],
true)
64 return BFile::createByFileId((
int) $value);
69 new Error(
'File not found.',
'FILE_NOT_FOUND')
77 new Error(
'Entity not allow.',
'ENTITY_NOT_ALLOW')
87 new Error(
'Access denied.',
'ACCESS_DENIED')
112 new ActionFilter\Authentication()
static loadMessages($file)