2namespace Bitrix\Landing;
4use \Bitrix\Main\Localization\Loc;
5use \Bitrix\Landing\Internals\RightsTable;
7Loc::loadMessages(__FILE__);
37 'knowledge_unexportable',
38 'knowledge_extension',
47 'knowledge_unexportable'
68 while ($role =
$res->fetch())
73 $resRight = RightsTable::getList([
79 'TASK_ID' => [$taskReadId, $taskDenyId],
80 'ROLE_ID' => $role[
'ID'],
84 if (!$resRight->fetch())
89 'TASK_ID' => $taskReadId,
90 'ROLE_ID' => $role[
'ID'],
101 $keyDemoInstalled =
'role_demo_installed';
104 $keyDemoInstalled .=
'_' . mb_strtolower(
$type);
116 static $roles =
null;
138 while ($row =
$res->fetch())
140 if (!trim($row[
'TITLE']))
142 $row[
'TITLE'] = Loc::getMessage(
'LANDING_ROLE_DEF_' . $row[
'XML_ID']);
144 $row[
'ACCESS_CODES'] = !$row[
'ACCESS_CODES'] ? [] : (
array)$row[
'ACCESS_CODES'];
145 $roles[$row[
'ID']] = $row;
146 $codes = array_merge($codes, $row[
'ACCESS_CODES']);
152 $codesNames =
$access->getNames($codes);
153 foreach ($roles as &$role)
155 foreach ($role[
'ACCESS_CODES'] as &
$code)
158 isset($codesNames[
$code][
'provider']) &&
159 $codesNames[
$code][
'provider']
161 ? $codesNames[
$code][
'provider']
164 ? $codesNames[
$code][
'name']
178 $keyDemoInstalled =
'role_demo_installed';
181 $keyDemoInstalled .=
'_'.mb_strtolower(
$type);
189 self::installDemo(
$type);
191 return self::fetchAll();
215 $defGroup =
'G' . $groupID;
222 if (mb_strpos($accessCode,
'_') > 0)
224 [$prefix, ] = explode(
'_', $accessCode);
225 $prefix = mb_strtoupper($prefix);
226 if ($prefix ==
$type)
228 $addRights[] = $accessCode;
231 else if (
$type ===
null)
233 $addRights[] = $accessCode;
237 $addRightsManager = $addRights;
238 foreach (self::$forbiddenManagerRights as $rightCode)
240 $key = array_search($rightCode, $addRightsManager,
true);
243 array_splice($addRightsManager,
$key, 1);
246 $addRightsAdmin = $addRights;
247 foreach (self::$forbiddenAdminRights as $rightCode)
249 $key = array_search($rightCode, $addRightsAdmin,
true);
252 array_splice($addRightsAdmin,
$key, 1);
265 'additional_rights' => $addRightsAdmin,
276 'additional_rights' => $addRightsManager,
295 'ADDITIONAL_RIGHTS' =>
$rights[
'additional_rights']
297 if (
$res->isSuccess())
335 $roleId = intval($roleId);
337 self::update($roleId, [
338 'ACCESS_CODES' => $codes
343 self::getRights($roleId)
357 $tasks = array_flip($tasks);
358 $roleId = intval($roleId);
361 $res = RightsTable::getlist([
367 'ROLE_ID' => $roleId,
371 while ($row =
$res->fetch())
373 if (!isset($tasks[$row[
'TASK_ID']]))
377 if (!isset($return[$row[
'ENTITY_ID']]))
379 $return[$row[
'ENTITY_ID']] = [];
381 $right = $tasks[$row[
'TASK_ID']];
382 if (!in_array(
$right, $return[$row[
'ENTITY_ID']]))
384 $return[$row[
'ENTITY_ID']][] =
$right;
409 $roleId = intval($roleId);
413 $setAdditionalRights =
function() use($roleId, $additionalRights)
416 if ($additionalRights !==
null)
418 if (!is_array($additionalRights))
420 $additionalRights = [];
422 self::update($roleId, [
423 'ADDITIONAL_RIGHTS' => $additionalRights
438 if ($row =
$res->fetch())
440 $accessCodes = $row[
'ACCESS_CODES'];
443 $accessCodes = [
'G1'];
448 $setAdditionalRights();
453 $res = RightsTable::getlist([
458 'ROLE_ID' => $roleId,
462 while ($row =
$res->fetch())
464 RightsTable::delete($row[
'ID']);
469 $setAdditionalRights();
479 'filter' => array_keys(
$rights)
481 while ($row =
$res->fetch())
483 $siteExists[] = $row[
'ID'];
491 if (!is_array($rightCodes))
499 if (in_array($deniedCode, $rightCodes))
501 $rightCodes = [$deniedCode];
503 else if (!in_array($readCode, $rightCodes))
505 $rightCodes[] = $readCode;
507 foreach ($rightCodes as $rightCode)
509 if (isset($tasks[$rightCode]))
511 foreach ($accessCodes as $accessCode)
514 'ROLE_ID' => $roleId,
517 'TASK_ID' => $tasks[$rightCode],
518 'ACCESS_CODE' => $accessCode
525 $setAdditionalRights();
528 "intranet_menu_binding"
541 self::$expectedType =
$type;
551 return self::$expectedType;
570 '=TYPE' => self::$expectedType
573 while ($row =
$res->fetch())
if(!Loader::includeModule('messageservice')) $provider
static getOption($code, $default=null)
const FEATURE_PERMISSIONS_AVAILABLE
static setOption($code, $value)
static enableFeatureTmp($feature)
static disableFeatureTmp($feature)
static checkFeature(string $feature, array $params=array())
static setRights($id, array $rights, $additional=null)
static setAccessCodes($id, array $codes=array())
static getList(array $params=[], $initiator=null)
static getAccessTasksReferences()
static refreshAdditionalRights(array $additionalRights=[])
static checkRequiredRoles()
static installDemo($type=null)
static setRights($roleId, $rights=[], $additionalRights=null)
static $forbiddenManagerRights
static setAccessCodes($roleId, array $codes=array())
static getExpectedRoleIds()
static getRights($roleId)
static setExpectedType($type)
static $forbiddenAdminRights
static getCurrentScopeId()
static GetIDByCode($code)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
if(!is_array($deviceNotifyCodes)) $access
if(empty($signedUserToken)) $key