Пример #1
0
    Bitrix\Security\Mfa\Otp::setMandatoryUsing($_POST['otp_mandatory_using'] === 'Y');
    if (is_array($_POST['otp_mandatory_rights'])) {
        Bitrix\Security\Mfa\Otp::setMandatoryRights($_POST['otp_mandatory_rights']);
    }
    if ($_REQUEST["save"] != "" && $_GET["return_url"] != "") {
        LocalRedirect($_GET["return_url"]);
    } else {
        LocalRedirect("/bitrix/admin/security_otp.php?lang=" . LANGUAGE_ID . $returnUrl . "&" . $tabControl->ActiveTabParam());
    }
}
$availableTypes = \Bitrix\Security\Mfa\Otp::getAvailableTypes();
$availableTypesDescription = \Bitrix\Security\Mfa\Otp::getTypesDescription();
$defaultType = \Bitrix\Security\Mfa\Otp::getDefaultType();
$targetRights = \Bitrix\Security\Mfa\Otp::getMandatoryRights();
$access = new CAccess();
$targetRightsNames = $access->GetNames($targetRights);
CJSCore::Init(array('access'));
$APPLICATION->AddHeadScript('/bitrix/js/security/admin/page/otp.js');
$APPLICATION->SetTitle(GetMessage("SEC_OTP_NEW_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
if (CSecurityUser::isActive()) {
    $messageType = "OK";
    $messageText = GetMessage("SEC_OTP_NEW_ON");
} else {
    $messageType = "ERROR";
    $messageText = GetMessage("SEC_OTP_NEW_OFF");
}
CAdminMessage::ShowMessage(array("MESSAGE" => $messageText, "TYPE" => $messageType, "HTML" => true));
?>

<form method="POST" action="security_otp.php?lang=<?php 
Пример #2
0
 public static function GetAccessNames()
 {
     $arCodes = array();
     foreach (self::$accessNames as $code => $name) {
         if ($name === null) {
             $arCodes[] = $code;
         }
     }
     if ($arCodes) {
         $access = new CAccess();
         $arNames = $access->GetNames($arCodes);
         foreach ($arNames as $code => $name) {
             self::$accessNames[$code] = trim(htmlspecialcharsbx($name['provider'] . ' ' . $name['name']));
         }
     }
     return self::$accessNames;
 }
Пример #3
0
	$arAllOptions["main"][] = array('note'=>GetMessage("MAIN_OPT_TIME_ZONE_NOTE"));
}

$arAllOptions["main"][] = GetMessage("main_options_map");
$arAllOptions["main"][] = Array("map_top_menu_type", GetMessage("MAIN_TOP_MENU_TYPE"), "top", Array("text", 30));
$arAllOptions["main"][] = Array("map_left_menu_type", GetMessage("MAIN_LEFT_MENU_TYPE"), "left", Array("text", 30));

//show public panel for users
CJSCore::Init(array('access'));

$arCodes = unserialize(COption::GetOptionString("main", "show_panel_for_users"));
if(!is_array($arCodes))
	$arCodes = array();

$access = new CAccess();
$arNames = $access->GetNames($arCodes);

$arSel = array();
foreach($arCodes as $code)
	$arSel[$code] = true;

$panel = "
<script type=\"text/javascript\">

BX.Access.Init({
	other: {disabled:true}
});

BX.Access.SetSelected(".CUtil::PhpToJSObject($arSel).");

function InsertAccess(arRights)
Пример #4
0
    protected static function LearningShowRights($lessonId, $variable_name, $arBaseRights, $arPossibleRights, $arActualRights, $arSelected = array(), $arHighLight = array(), $readOnly)
    {
        $js_var_name = preg_replace("/[^a-zA-Z0-9_]/", "_", $variable_name);
        $html_var_name = htmlspecialcharsbx($variable_name);
        $sSelect = '<select name="' . $html_var_name . '[][TASK_ID]" style="vertical-align:middle">';
        foreach ($arPossibleRights as $taskId => $arRightsData) {
            $selected = '';
            if (strtoupper($arRightsData['name']) === 'LEARNING_LESSON_ACCESS_DENIED') {
                $selected = ' selected="selected" ';
            }
            $sSelect .= '<option value="' . (int) $taskId . '" ' . $selected . '>' . htmlspecialcharsex($arRightsData['name_human']) . '</option>';
        }
        $sSelect .= '</select>';
        $table_id = $variable_name . "_table";
        $href_id = $variable_name . "_href";
        CJSCore::Init(array('access'));
        ?>
		<tr>
			<td colspan="2" align="center">
				<input type="hidden" name="<?php 
        echo $variable_name . '_marker';
        ?>
" value='yeah!'>
				<script type="text/javascript">
					var obLearningJSRightsAccess_<?php 
        echo $js_var_name;
        ?>
 = new LearningJSRightsAccess(
						<?php 
        echo intval($lessonId);
        ?>
,
						<?php 
        echo CUtil::PhpToJsObject($arSelected);
        ?>
,
						'<?php 
        echo CUtil::JSEscape($variable_name);
        ?>
',
						'<?php 
        echo CUtil::JSEscape($table_id);
        ?>
',
						'<?php 
        echo CUtil::JSEscape($href_id);
        ?>
',
						'<?php 
        echo CUtil::JSEscape($sSelect);
        ?>
',
						<?php 
        echo CUtil::PhpToJsObject($arHighLight);
        ?>
					);
				</script>
				<h3><?php 
        echo GetMessage('LEARNING_RIGHTS_FOR_ADMINISTRATION');
        ?>
</h3>
				<table width="100%" cellpadding="0" cellspacing="10" border="0" id="<?php 
        echo htmlspecialcharsbx($table_id);
        ?>
" align="center">
				<?php 
        $access = new CAccess();
        // If rights are for lesson => show base rights
        if ($lessonId !== false) {
            $arBaseNames = $access->GetNames(array_keys($arBaseRights));
            foreach ($arBaseRights as $symbol => $taskId) {
                if ($taskId <= 0) {
                    continue;
                }
                ?>
					<tr valign="top">
						<td align="right"><?php 
                echo htmlspecialcharsex($arBaseNames[$symbol]['provider'] . ' ' . $arBaseNames[$symbol]['name']);
                ?>
:&nbsp;</td>
						<td align="left">
							<?php 
                echo htmlspecialcharsex(CLearnAccess::GetNameForTask($taskId));
                ?>
						</td>
					</tr>
					<?php 
            }
        }
        $arNames = $access->GetNames(array_keys($arActualRights));
        foreach ($arActualRights as $symbol => $taskId) {
            if ($taskId <= 0) {
                continue;
            }
            ?>
				<tr valign="top">
					<td align="right">
						<div style="padding-top:8px;">
						<span href="javascript:void(0);" 
							onclick="LearningJSRightsAccess.DeleteRow(
								this, 
								'<?php 
            echo htmlspecialcharsbx(CUtil::addslashes($symbol));
            ?>
', 
								'<?php 
            echo CUtil::JSEscape($html_var_name);
            ?>
')" 
							class="access-delete"
							style="position:relative; top:1px; margin-right:3px;"
						></span><?php 
            if (strlen($arNames[$symbol]['provider'])) {
                echo htmlspecialcharsex($arNames[$symbol]['provider'] . ' ' . $arNames[$symbol]['name']);
            } else {
                echo htmlspecialcharsex($arNames[$symbol]['name']);
            }
            ?>
:&nbsp;
					</div>
					</td>
					<td align="left">
						<?php 
            if ($readOnly) {
                echo htmlspecialcharsex(CLearnAccess::GetNameForTask($taskId));
            } else {
                ?>
						<input type="hidden" name="<?php 
                echo $html_var_name;
                ?>
[][GROUP_CODE]" value="<?php 
                echo htmlspecialcharsbx($symbol);
                ?>
">
						<div style="min-width:720px;">
							<select name="<?php 
                echo $html_var_name;
                ?>
[][TASK_ID]" style="vertical-align:middle">
						<?php 
                foreach ($arPossibleRights as $id => $arRightsData) {
                    ?>
							<option value="<?php 
                    echo (int) $id;
                    ?>
" <?php 
                    if ($id == $taskId) {
                        echo "selected";
                    }
                    ?>
><?php 
                    echo htmlspecialcharsex(CLearnAccess::GetNameForTask($id));
                    ?>
</option>
							<?php 
                }
                ?>
						</select>
						</div>
						<?php 
            }
            ?>
					</td>
				</tr>
				<?php 
        }
        if (!$readOnly) {
            ?>
					<tr>
						<td width="40%" align="right">&nbsp;</td>
						<td width="60%" align="left">
							<a href="javascript:void(0)"  id="<?php 
            echo htmlspecialcharsbx($href_id);
            ?>
" class="bx-action-href"><?php 
            echo GetMessage("LEARNING_RIGHTS_ADD");
            ?>
</a>
						</td>
					</tr>
				<?php 
        }
        ?>
				</table>
				<br>
				<strong><?php 
        echo GetMessage('LEARNING_RIGHTS_NOTE');
        ?>
</strong>
			</td>
		</tr>
		<?php 
    }
Пример #5
0
echo GetMessage("EDIT_ACCESS_USER_GROUP");
?>
</b></td>
		<td><b><?php 
echo GetMessage("EDIT_ACCESS_PERMISSION");
?>
</b> </td>
	</tr>
	<tr class="empty">
		<td colspan="2"></td>
	</tr>

<?
//names for access codes
$access = new CAccess();
$arNames = $access->GetNames($arUserGroupsID, true);

//Javascript variables
$jsTaskArray = "window.BXTaskArray = {'0':'".CUtil::JSEscape(GetMessage("EDIT_ACCESS_SET_INHERIT"))."'";
foreach ($arPermTypes as $taskID => $taskTitle)
	$jsTaskArray .= ",'".$taskID."':'".CUtil::JSEscape($taskTitle)."'";
$jsTaskArray .= "};";

$jsInheritPerm = "";
$jsInheritPermID = "var jsInheritPermIDs = [";
$bWasCurrentPerm = false;

foreach($arNames as $access_code => $dummy):
	if(!in_array($access_code, $arUserGroupsID))
		continue;
Пример #6
0
									}, toAllCheckBox));
								}
							</script>
							<?
						}
					?></td>
				</tr><?
			}
			elseif ($Option[0] == "livefeed_toall_rights")
			{
				$arToAllRights = unserialize($val);
				if (!$arToAllRights)
					$arToAllRights = unserialize($Option[2]);

				$access = new CAccess();
				$arNames = $access->GetNames($arToAllRights);

				?><tr id="RIGHTS_all" style="display: <?php 
echo COption::GetOptionString("socialnetwork", "allow_livefeed_toall", "Y") == "Y" ? "table-row" : "none";
?>
;"><td>&nbsp;</td><td><?
				?><script>
				
					var rightsCont = BX('RIGHTS_all');
					if (toAllCheckBox && rightsCont)
					{
						BX.bind(toAllCheckBox, 'click', BX.delegate(function(e) {
							rightsCont.style.display = (this.checked ? "" : "none");
						}, toAllCheckBox));
					}
				
Пример #7
0
function IBlockShowRights($entity_type, $iblock_id, $id, $section_title, $variable_name, $arPossibleRights, $arActualRights, $bDefault = false, $bForceInherited = false, $arSelected = array(), $arHighLight = array())
{
    $js_var_name = preg_replace("/[^a-zA-Z0-9_]/", "_", $variable_name);
    $html_var_name = htmlspecialcharsbx($variable_name);
    $sSelect = '<select name="' . $html_var_name . '[][TASK_ID]" style="vertical-align:middle">';
    foreach ($arPossibleRights as $value => $title) {
        $sSelect .= '<option value="' . htmlspecialcharsbx($value) . '">' . htmlspecialcharsex($title) . '</option>';
    }
    $sSelect .= '</select>';
    if ($bForceInherited != true) {
        foreach ($arActualRights as $RIGHT_ID => $arRightSet) {
            if ($arRightSet["IS_INHERITED"] != "Y") {
                $arSelected[$arRightSet["GROUP_CODE"]] = true;
            }
        }
    }
    $table_id = $variable_name . "_table";
    $href_id = $variable_name . "_href";
    CJSCore::Init(array('access'));
    ?>
	<tr>
		<td colspan="2" align="center">
			<script type="text/javascript">
				BX.message({
						langApplyTitle: '<?php 
    echo CUtil::JSEscape(GetMessage("IBLOCK_AT_OVERWRITE_TIP"));
    ?>
',
						langApply1Title: '<?php 
    echo CUtil::JSEscape(GetMessage("IBLOCK_AT_OVERWRITE_1"));
    ?>
',
						langApply2Title: '<?php 
    echo CUtil::JSEscape(GetMessage("IBLOCK_AT_OVERWRITE_2"));
    ?>
',
						langApply3Title: '<?php 
    echo CUtil::JSEscape(GetMessage("IBLOCK_AT_OVERWRITE_3"));
    ?>
'
				});
				var obIBlockAccess_<?php 
    echo $js_var_name;
    ?>
 = new JCIBlockAccess(
					'<?php 
    echo CUtil::JSEscape($entity_type);
    ?>
',
					<?php 
    echo intval($iblock_id);
    ?>
,
					<?php 
    echo intval($id);
    ?>
,
					<?php 
    echo CUtil::PhpToJsObject($arSelected);
    ?>
,
					'<?php 
    echo CUtil::JSEscape($variable_name);
    ?>
',
					'<?php 
    echo CUtil::JSEscape($table_id);
    ?>
',
					'<?php 
    echo CUtil::JSEscape($href_id);
    ?>
',
					'<?php 
    echo CUtil::JSEscape($sSelect);
    ?>
',
					<?php 
    echo CUtil::PhpToJsObject($arHighLight);
    ?>
				);
			</script>
			<table width="100%" class="internal" id="<?php 
    echo htmlspecialcharsbx($table_id);
    ?>
" align="center">
			<?php 
    if ($section_title != "") {
        ?>
			<tr id="<?php 
        echo $html_var_name;
        ?>
_heading" class="heading">
				<td colspan="2">
					<?php 
        echo $section_title;
        ?>
				</td>
			</tr>
			<?php 
    }
    ?>
			<?php 
    $arNames = array();
    foreach ($arActualRights as $arRightSet) {
        $arNames[] = $arRightSet["GROUP_CODE"];
    }
    $access = new CAccess();
    $arNames = $access->GetNames($arNames);
    foreach ($arActualRights as $RIGHT_ID => $arRightSet) {
        if ($bForceInherited || $arRightSet["IS_INHERITED"] == "Y") {
            ?>
					<tr class="<?php 
            echo $html_var_name;
            ?>
_row_for_<?php 
            echo htmlspecialcharsbx($arRightSet["GROUP_CODE"]);
            if ($arRightSet["IS_OVERWRITED"] == "Y") {
                echo " iblock-strike-out";
            }
            ?>
">
						<td style="width:40%!important; text-align:right"><?php 
            echo htmlspecialcharsex($arNames[$arRightSet["GROUP_CODE"]]["provider"] . " " . $arNames[$arRightSet["GROUP_CODE"]]["name"]);
            ?>
:</td>
						<td align="left">
							<?php 
            if ($arRightSet["IS_OVERWRITED"] != "Y") {
                ?>
							<input type="hidden" name="<?php 
                echo $html_var_name;
                ?>
[][RIGHT_ID]" value="<?php 
                echo htmlspecialcharsbx($RIGHT_ID);
                ?>
">
							<input type="hidden" name="<?php 
                echo $html_var_name;
                ?>
[][GROUP_CODE]" value="<?php 
                echo htmlspecialcharsbx($arRightSet["GROUP_CODE"]);
                ?>
">
							<input type="hidden" name="<?php 
                echo $html_var_name;
                ?>
[][TASK_ID]" value="<?php 
                echo htmlspecialcharsbx($arRightSet["TASK_ID"]);
                ?>
">
							<?php 
            }
            ?>
							<?php 
            echo htmlspecialcharsex($arPossibleRights[$arRightSet["TASK_ID"]]);
            ?>
						</td>
					</tr>
					<?php 
        }
    }
    if ($bForceInherited != true) {
        foreach ($arActualRights as $RIGHT_ID => $arRightSet) {
            if ($arRightSet["IS_INHERITED"] != "Y") {
                ?>
					<tr>
						<td style="width:40%!important; text-align:right; vertical-align:middle"><?php 
                echo htmlspecialcharsex($arNames[$arRightSet["GROUP_CODE"]]["provider"] . " " . $arNames[$arRightSet["GROUP_CODE"]]["name"]);
                ?>
:</td>
						<td align="left">
							<input type="hidden" name="<?php 
                echo $html_var_name;
                ?>
[][RIGHT_ID]" value="<?php 
                echo htmlspecialcharsbx($RIGHT_ID);
                ?>
">
							<input type="hidden" name="<?php 
                echo $html_var_name;
                ?>
[][GROUP_CODE]" value="<?php 
                echo htmlspecialcharsbx($arRightSet["GROUP_CODE"]);
                ?>
">
							<select name="<?php 
                echo $html_var_name;
                ?>
[][TASK_ID]" style="vertical-align:middle">
							<?php 
                foreach ($arPossibleRights as $value => $title) {
                    ?>
								<option value="<?php 
                    echo htmlspecialcharsbx($value);
                    ?>
" <?php 
                    if ($value == $arRightSet["TASK_ID"]) {
                        echo "selected";
                    }
                    ?>
><?php 
                    echo htmlspecialcharsex($title);
                    ?>
</option>
							<?php 
                }
                ?>
							</select>
							<a href="javascript:void(0);" onclick="JCIBlockAccess.DeleteRow(this, '<?php 
                echo htmlspecialcharsbx(CUtil::addslashes($arRightSet["GROUP_CODE"]));
                ?>
', '<?php 
                echo CUtil::JSEscape($variable_name);
                ?>
')" class="access-delete"></a>
							<?php 
                if ($bDefault) {
                    ?>
								<span title="<?php 
                    echo GetMessage("IBLOCK_AT_OVERWRITE_TIP");
                    ?>
"><?php 
                    if (is_array($arRightSet["OVERWRITED"]) && $arRightSet["OVERWRITED"][0] > 0 && $arRightSet["OVERWRITED"][1] > 0) {
                        ?>
									<br><input name="<?php 
                        echo $html_var_name;
                        ?>
[][DO_CLEAN]" value="Y" type="checkbox"><?php 
                        echo GetMessage("IBLOCK_AT_OVERWRITE_1");
                        ?>
 (<?php 
                        echo intval($arRightSet["OVERWRITED"][0] + $arRightSet["OVERWRITED"][1]);
                        ?>
)
									<?php 
                    } elseif (is_array($arRightSet["OVERWRITED"]) && $arRightSet["OVERWRITED"][0] > 0) {
                        ?>
									<br><input name="<?php 
                        echo $html_var_name;
                        ?>
[][DO_CLEAN]" value="Y" type="checkbox"><?php 
                        echo GetMessage("IBLOCK_AT_OVERWRITE_2");
                        ?>
 (<?php 
                        echo intval($arRightSet["OVERWRITED"][0]);
                        ?>
)
									<?php 
                    } elseif (is_array($arRightSet["OVERWRITED"]) && $arRightSet["OVERWRITED"][1] > 0) {
                        ?>
									<br><input name="<?php 
                        echo $html_var_name;
                        ?>
[][DO_CLEAN]" value="Y" type="checkbox"><?php 
                        echo GetMessage("IBLOCK_AT_OVERWRITE_3");
                        ?>
 (<?php 
                        echo intval($arRightSet["OVERWRITED"][1]);
                        ?>
)
									<?php 
                    }
                    ?>
</span>
							<?php 
                }
                ?>
						</td>
					</tr>
					<?php 
            }
        }
    }
    ?>
				<tr>
					<td width="40%" align="right">&nbsp;</td>
					<td width="60%" align="left">
						<a href="javascript:void(0)"  id="<?php 
    echo htmlspecialcharsbx($href_id);
    ?>
" class="bx-action-href"><?php 
    echo GetMessage("IBLOCK_AT_PROP_ADD");
    ?>
</a>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<?php 
}
Пример #8
0
 }
 if (isset($arTaskLetters['T'])) {
     unset($arTasks[$arTaskLetters['T']]);
 }
 $arResult['PERMISSIONS'] = $arTasks;
 if (!$bCreate) {
     $arRightParams = array("count_overwrited" => true);
     if (!empty($arResult['ENTITY_PARENTS'])) {
         $arRightParams['parents'] = $arResult['ENTITY_PARENTS'];
     }
     $arCurrent = $obIBlockRights->GetRights($arRightParams);
     foreach ($arCurrent as $arRightSet) {
         $arNames[] = $arRightSet["GROUP_CODE"];
     }
     $access = new CAccess();
     $arSubjs = $access->GetNames($arNames);
     if (!empty($arParams['SOCNET_TYPE']) && !$USER->CanDoOperation('webdav_change_settings') && intval($arParams['SOCNET_ID']) > 0) {
         foreach ($arCurrent as $rightID => &$arRight) {
             if ($arRight['GROUP_CODE'] === 'G1' && $arRight['IS_INHERITED'] === 'Y' && $arRight['TASK_ID'] === $arTaskLetters['X'] || $arRight['GROUP_CODE'] === 'G2' && $arRight['IS_INHERITED'] === 'Y' && $arRight['TASK_ID'] === $arTaskLetters['D']) {
                 unset($arCurrent[$rightID]);
                 // commont rights
                 continue;
             }
             if ($arParams['SOCNET_TYPE'] == 'group') {
                 if ($arRight['GROUP_CODE'] === 'SG' . $arParams['SOCNET_ID'] . '_A' && $arRight['TASK_ID'] === $arTaskLetters['X']) {
                     $arRight['IS_INHERITED'] = 'Y';
                 }
                 // group admin
             } elseif ($arParams['SOCNET_TYPE'] == 'user') {
                 if ($arRight['GROUP_CODE'] === 'U' . $arParams['SOCNET_ID'] && $arRight['TASK_ID'] === $arTaskLetters['X']) {
                     $arRight['IS_INHERITED'] = 'Y';
Пример #9
0
 public static function PushAccessNames($arCodes = array())
 {
     foreach ($arCodes as $code) {
         if (empty(self::$accessNames[$code])) {
             $access = new CAccess();
             $arNames = $access->GetNames($arCodes);
             foreach ($arNames as $c => $val) {
                 self::$accessNames[$c] = trim(htmlspecialcharsbx($val['provider'] . ' ' . $val['name']));
             }
             break;
         }
     }
 }
Пример #10
0
while ($arRole = $obRes->Fetch()) {
    $arRole['PATH_TO_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_ROLE_EDIT'], array('role_id' => $arRole['ID']));
    $arRole['PATH_TO_DELETE'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_ROLE_EDIT'], array('role_id' => $arRole['ID'])), array('delete' => '1', 'sessid' => bitrix_sessid()));
    $arRole['NAME'] = htmlspecialcharsbx($arRole['NAME']);
    $arResult['ROLE'][$arRole['ID']] = $arRole;
}
// get role relation
$arResult['RELATION'] = array();
$arResult['RELATION_ENTITY'] = array();
$obRes = CCrmRole::GetRelation();
while ($arRelation = $obRes->Fetch()) {
    $arResult['RELATION'][$arRelation['RELATION']] = $arRelation;
    $arResult['RELATION_ENTITY'][$arRelation['RELATION']] = true;
}
$CAccess = new CAccess();
$arNames = $CAccess->GetNames(array_keys($arResult['RELATION_ENTITY']));
foreach ($arResult['RELATION'] as &$arRelation) {
    //Issue #43598
    $arRelation['NAME'] = htmlspecialcharsbx($arNames[$arRelation['RELATION']]['name']);
    $providerName = $arNames[$arRelation['RELATION']]['provider'];
    if (!empty($providerName)) {
        $arRelation['NAME'] = '<b>' . htmlspecialcharsbx($providerName) . ':</b> ' . $arRelation['NAME'];
    }
}
unset($arRelation);
//Issue #38744
/*if(IsModuleInstalled('bitrix24'))
{
	$arResult['DISABLED_PROVIDERS'] = array('group');
}*/
$this->IncludeComponentTemplate();