1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
AccessCodeTrait.php
См. документацию.
1<?php
2
4
6
7trait AccessCodeTrait
8{
9 private function getSpaceIdsFromCodes(array $codes, Recepient $recipient): array
10 {
11 $result = [];
12
13 foreach ($codes as $code)
14 {
15 if (!is_string($code))
16 {
17 continue;
18 }
19
20 $groupId = $this->getSpaceIdFromCode($code, $recipient);
21
22 if (!is_null($groupId) && $groupId >= 0)
23 {
24 $result[] = $groupId;
25 }
26 }
27
28 return $result;
29 }
30
31 private function getSpaceIdFromCode(string $code, Recepient $recipient): ?int
32 {
33 if (str_starts_with($code, 'SG'))
34 {
35 return $this->getSpaceIdFromGroupCode($code);
36 }
37
38 return $this->getSpaceIdFromOrdinaryCode($code, $recipient);
39 }
40
41 private function getSpaceIdFromGroupCode(string $code): ?int
42 {
43 $explodedCode = explode('_', $code)[0] ?? '';
44 $groupId = (int)substr($explodedCode, 2);
45
46 if ($groupId > 0)
47 {
48 return $groupId;
49 }
50
51 return null;
52 }
53
54 private function getSpaceIdFromOrdinaryCode(string $code, Recepient $recipient): ?int
55 {
56 if (preg_match('/^(U|UA|AU|D|DR|G2)/', $code) && in_array($code, $recipient->getAccessCodes(), true))
57 {
58 return 0;
59 }
60
61 return null;
62 }
63}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195