1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
IblockCatalogPermissionStepper.php
См. документацию.
1<?php
2
3namespace Bitrix\Catalog\Access\Permission\Catalog;
4
5use Bitrix\Catalog\Access\ShopGroupAssistant;
6use Bitrix\Main\Loader;
7use Bitrix\Main\Update\Stepper;
8use Bitrix\Main\UserTable;
9
20{
21 private const PORTION = 100;
22
23 protected static $moduleId = 'catalog';
24
25 public function execute(array &$option): bool
26 {
27 if (!Loader::includeModule('iblock'))
28 {
29 return self::FINISH_EXECUTION;
30 }
31
32 $emptyDepartmentTypeFirst = serialize([]);
33 $emptyDepartmentTypeSecond = serialize([0]);
34 $externalTypes = UserTable::getExternalUserTypes();
35 $externalTypes[] = null;
36 $filter = [
37 '!=UF_DEPARTMENT' => [null, $emptyDepartmentTypeFirst, $emptyDepartmentTypeSecond],
38 '!=EXTERNAL_AUTH_ID' => $externalTypes,
39 ];
40
41 if (isset($option['lastId']))
42 {
43 $filter['>ID'] = (int)$option['lastId'];
44 }
45
46 $userData = UserTable::getList([
47 'filter' => $filter,
48 'select' => ['ID'],
49 'limit' => self::PORTION,
50 ])
51 ->fetchAll()
52 ;
53
54 $userIds = array_column($userData, 'ID');
55 if ($userIds)
56 {
57 $this->updateIblockAccess($userIds);
58 if (count($userIds) === self::PORTION)
59 {
60 $option['lastId'] = array_pop($userIds);
61
62 return self::CONTINUE_EXECUTION;
63 }
64 }
65
66 return self::FINISH_EXECUTION;
67 }
68
69 private function updateIblockAccess(array $userIds): void
70 {
71 $userGroupMap = [
74 ];
75
76 foreach ($userIds as $userId)
77 {
78 $groupCode = ShopGroupAssistant::getShopUserGroupCode($userId);
79 if ($groupCode && isset($userGroupMap[$groupCode]))
80 {
81 $userGroupMap[$groupCode][] = $userId;
82 }
83 }
84
85 foreach ($userGroupMap as $groupCode => $groupUserIds)
86 {
88 $groupUserIds,
89 $userIds,
90 $groupCode
91 );
92 }
93 }
94}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static updateShopAccessGroup(array $userIds, array $allUserIds, string $groupType)
static getExternalUserTypes()
Определения user.php:307
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$filter
Определения iblock_catalog_list.php:54
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
$option
Определения options.php:1711