Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
user.php
1<?php
2
3namespace Bitrix\Im\Model;
4
7
12{
18 public static function filterExternalUserTypes(array $skipTypes = []): array
19 {
20 $types = \Bitrix\Main\UserTable::getExternalUserTypes();
21 if (empty($skipTypes))
22 {
23 return $types;
24 }
25
26 $types = array_filter($types, function($authId) use ($skipTypes) {
27 return !in_array($authId, $skipTypes, true);
28 });
29
30 return $types;
31 }
32
33 public static function getMap()
34 {
35 $emptyValue = serialize([]);
36 $emptyValue2 = serialize([0]);
37
38 $additionalFields = [
39 (new ExpressionField(
40 'IS_INTRANET_USER',
41 'CASE WHEN
42 ((%s IS NOT NULL AND %s != \'' . $emptyValue . '\' AND %s != \'' . $emptyValue2 . '\') AND
43 (%s IS NULL OR %s NOT IN (\'' . implode('\', \'', self::filterExternalUserTypes(['bot'])) . '\')))
44 OR (%s = \'bot\')
45 THEN \'Y\'
46 ELSE \'N\'
47 END',
48 ['UF_DEPARTMENT', 'UF_DEPARTMENT', 'UF_DEPARTMENT', 'EXTERNAL_AUTH_ID', 'EXTERNAL_AUTH_ID', 'EXTERNAL_AUTH_ID'],
49 ['values' => ['N', 'Y']]
50 ))->configureValueType(BooleanField::class)
51 ];
52
53 return array_merge(parent::getMap(), $additionalFields);
54 }
55}
static filterExternalUserTypes(array $skipTypes=[])
Definition user.php:18