本文整理汇总了PHP中CIBlockRights类的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockRights类的具体用法?PHP CIBlockRights怎么用?PHP CIBlockRights使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CIBlockRights类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canRead
public function canRead($userId)
{
if (!Loader::includeModule("iblock")) {
return false;
}
$iblockId = $this->entityId;
return \CIBlockRights::userHasRightTo($iblockId, $iblockId, "element_read") || \CIBlockSectionRights::userHasRightTo($iblockId, 0, "section_element_bind");
}
示例2: CheckIBlockOperation
public static function CheckIBlockOperation($intIBlockID, $strOperation, $strAccess)
{
$intIBlockID = intval($intIBlockID);
if ($intIBlockID <= 0) {
return false;
}
if (!self::$boolCheck) {
self::CheckExtRights();
}
if (self::$boolExtRights) {
return CIBlockRights::UserHasRightTo($intIBlockID, $intIBlockID, $strOperation);
} else {
return CIBlock::GetPermission($intIBlockID) >= $strAccess;
}
}
示例3: executeComponent
public function executeComponent()
{
global $USER, $APPLICATION;
$this->setFrameMode(false);
if (!CModule::IncludeModule('lists')) {
ShowError(Loc::getMessage("CC_BLL_MODULE_NOT_INSTALLED"));
return;
}
$this->arResult["BIZPROC"] = (bool) CModule::includeModule("bizproc");
$this->arResult["DISK"] = (bool) CModule::includeModule("disk");
$this->listsPerm = CListPermissions::CheckAccess($USER, $this->arParams["~IBLOCK_TYPE_ID"], $this->arResult["IBLOCK_ID"], $this->arParams["~SOCNET_GROUP_ID"]);
if ($this->listsPerm < 0) {
switch ($this->listsPerm) {
case CListPermissions::WRONG_IBLOCK_TYPE:
ShowError(GetMessage("CC_BLL_WRONG_IBLOCK_TYPE"));
return;
case CListPermissions::WRONG_IBLOCK:
ShowError(GetMessage("CC_BLL_WRONG_IBLOCK"));
return;
case CListPermissions::LISTS_FOR_SONET_GROUP_DISABLED:
ShowError(GetMessage("CC_BLL_LISTS_FOR_SONET_GROUP_DISABLED"));
return;
default:
ShowError(GetMessage("CC_BLL_UNKNOWN_ERROR"));
return;
}
} elseif ($this->listsPerm < CListPermissions::CAN_READ && !(CIBlockRights::UserHasRightTo($this->arResult["IBLOCK_ID"], $this->arResult["IBLOCK_ID"], "element_read") || CIBlockSectionRights::UserHasRightTo($this->arResult["IBLOCK_ID"], $this->arResult["SECTION_ID"], "section_element_bind"))) {
ShowError(GetMessage("CC_BLL_ACCESS_DENIED"));
return;
}
if (!(!$this->arResult["IS_SOCNET_GROUP_CLOSED"] && ($this->listsPerm > CListPermissions::CAN_READ || CIBlockSectionRights::UserHasRightTo($this->arResult["IBLOCK_ID"], $this->arResult["SECTION_ID"], "element_read") || CIBlockSectionRights::UserHasRightTo($this->arResult["IBLOCK_ID"], $this->arResult["SECTION_ID"], "section_element_bind")))) {
ShowError(GetMessage("CC_BLL_ACCESS_DENIED"));
return;
}
$this->createDataExcel();
$APPLICATION->RestartBuffer();
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: filename=list_" . $this->arIBlock["ID"] . ".xls");
$this->IncludeComponentTemplate();
$r = $APPLICATION->EndBufferContentMan();
echo $r;
include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
die;
}
示例4: checkPermission
protected function checkPermission()
{
global $USER;
$this->listPerm = CListPermissions::checkAccess($USER, $this->iblockTypeId, $this->iblockId, $this->socnetGroupId);
if ($this->listPerm < 0) {
switch ($this->listPerm) {
case CListPermissions::WRONG_IBLOCK_TYPE:
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_WRONG_IBLOCK_TYPE'))));
break;
case CListPermissions::WRONG_IBLOCK:
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_WRONG_IBLOCK'))));
break;
case CListPermissions::LISTS_FOR_SONET_GROUP_DISABLED:
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_SONET_GROUP_DISABLED'))));
break;
default:
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_UNKNOWN_ERROR'))));
break;
}
} elseif ($this->listPerm < CListPermissions::CAN_READ && !(CIBlockRights::userHasRightTo($this->iblockId, $this->iblockId, "element_read") || CIBlockSectionRights::userHasRightTo($this->iblockId, $this->sectionId, "section_element_bind"))) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_LAC_ACCESS_DENIED'))));
}
}
示例5: GetAllowableUserGroups
/**
* @param $documentType
* @param bool $withExtended
* @return array|bool
*/
public function GetAllowableUserGroups($documentType, $withExtended = false)
{
$documentType = trim($documentType);
if (strlen($documentType) <= 0) {
return false;
}
$iblockId = intval(substr($documentType, strlen("iblock_")));
$result = array("Author" => GetMessage("IBD_DOCUMENT_AUTHOR"));
$groupsId = array(1);
$extendedGroupsCode = array();
if (CIBlock::getArrayByID($iblockId, "RIGHTS_MODE") === "E") {
$rights = new CIBlockRights($iblockId);
foreach ($rights->getGroups() as $iblockGroupCode) {
if (preg_match("/^G(\\d+)\$/", $iblockGroupCode, $match)) {
$groupsId[] = $match[1];
} else {
$extendedGroupsCode[] = $iblockGroupCode;
}
}
} else {
foreach (CIBlock::getGroupPermissions($iblockId) as $groupId => $perm) {
if ($perm > "R") {
$groupsId[] = $groupId;
}
}
}
$groupsIterator = CGroup::getListEx(array("NAME" => "ASC"), array("ID" => $groupsId));
while ($group = $groupsIterator->fetch()) {
$result[$group["ID"]] = $group["NAME"];
}
if ($withExtended && $extendedGroupsCode) {
foreach ($extendedGroupsCode as $groupCode) {
$result['group_' . $groupCode] = CBPHelper::getExtendedGroupName($groupCode);
}
}
return $result;
}
示例6: elseif
$intIBlockID = false;
if (isset($_REQUEST["PARAMS"]['IBLOCK_ID'])) {
$intIBlockID = (int) $_REQUEST["PARAMS"]['IBLOCK_ID'];
} elseif (isset($_REQUEST["IBLOCK_ID"])) {
$intIBlockID = (int) $_REQUEST["IBLOCK_ID"];
}
if ($intIBlockID < 0 || $intIBlockID === false) {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
ShowError(GetMessage("BT_ADM_IEP_IBLOCK_ID_IS_INVALID"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
} elseif ($intIBlockID > 0) {
$rsIBlocks = CIBlock::GetList(array(), array("ID" => $intIBlockID, "CHECK_PERMISSIONS" => "N"));
$arIBlock = $rsIBlocks->Fetch();
if ($arIBlock) {
if (!CIBlockRights::UserHasRightTo($intIBlockID, $intIBlockID, "iblock_edit")) {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
} else {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
ShowError(str_replace('#ID#', $intIBlockID, GetMessage("BT_ADM_IEP_IBLOCK_NOT_EXISTS")));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
}
if (isset($_REQUEST["PARAMS"]['ID'])) {
$str_PROPERTY_ID = htmlspecialcharsbx($_REQUEST["PARAMS"]['ID']);
} elseif (isset($_REQUEST['ID'])) {
示例7: array
die;
}
$boolOffers = false;
$arOffers = false;
$arOfferIBlock = false;
$intOfferIBlockID = 0;
$arSelectOfferProps = array();
$arSelectedPropTypes = array('S', 'N', 'L', 'E', 'G');
$arOffersSelectKeys = array(YANDEX_SKU_EXPORT_ALL, YANDEX_SKU_EXPORT_MIN_PRICE, YANDEX_SKU_EXPORT_PROP);
$arOffers = CCatalogSKU::GetInfoByProductIBlock($intIBlockID);
if (!empty($arOffers['IBLOCK_ID'])) {
$intOfferIBlockID = $arOffers['IBLOCK_ID'];
$strPerm = 'D';
$rsOfferIBlocks = CIBlock::GetByID($intOfferIBlockID);
if ($arOfferIBlock = $rsOfferIBlocks->Fetch()) {
$bBadBlock = !CIBlockRights::UserHasRightTo($intOfferIBlockID, $intOfferIBlockID, "iblock_admin_display");
if ($bBadBlock) {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
echo ShowError(GetMessage('YANDEX_ERR_NO_ACCESS_IBLOCK_SKU'));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
} else {
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
echo ShowError(str_replace('#ID#', $intIBlockID, GetMessage("YANDEX_ERR_NO_IBLOCK_SKU_FOUND")));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
die;
}
$boolOffers = true;
}
$arCondSelectProp = array('ZERO' => GetMessage('YANDEX_SKU_EXPORT_PROP_SELECT_ZERO'), 'NONZERO' => GetMessage('YANDEX_SKU_EXPORT_PROP_SELECT_NONZERO'), 'EQUAL' => GetMessage('YANDEX_SKU_EXPORT_PROP_SELECT_EQUAL'), 'NONEQUAL' => GetMessage('YANDEX_SKU_EXPORT_PROP_SELECT_NONEQUAL'));
示例8: define
die;
}
if (preg_match('/^[a-z0-9_]{2}$/i', $_REQUEST['site'])) {
define('SITE_ID', $_REQUEST['site']);
}
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
Loc::loadMessages(__FILE__);
global $APPLICATION;
if (!CModule::IncludeModule('iblock')) {
echo Loc::getMessage("BT_COMP_MLI_AJAX_ERR_MODULE_ABSENT");
die;
}
CUtil::JSPostUnescape();
$IBlockID = intval($_REQUEST["IBLOCK_ID"]);
if (!CIBlockRights::UserHasRightTo($IBlockID, $IBlockID, "iblock_admin_display")) {
echo Loc::getMessage('BT_COMP_MLI_AJAX_ERR_IBLOCK_ACCESS_DENIED');
die;
}
$arIBlock = CIBlock::GetArrayByID($IBlockID);
$strBanSym = trim($_REQUEST['BAN_SYM']);
$arBanSym = str_split($strBanSym, 1);
$strRepSym = trim($_REQUEST['REP_SYM']);
$arRepSym = array_fill(0, sizeof($arBanSym), $strRepSym);
$bSection = false;
if (isset($_REQUEST['TYPE']) && 'SECTION' == $_REQUEST['TYPE']) {
$bSection = true;
}
if ($_REQUEST['MODE'] == 'SEARCH') {
$APPLICATION->RestartBuffer();
$arResult = array();
示例9: intval
CUtil::JSPostUnescape();
$iblock_id = intval($_REQUEST["IBLOCK_ID"]);
$lists_perm = CListPermissions::CheckAccess($USER, $_REQUEST["IBLOCK_TYPE_ID"], $iblock_id, $_REQUEST["SOCNET_GROUP_ID"]);
if ($lists_perm < 0) {
switch ($lists_perm) {
case CListPermissions::WRONG_IBLOCK_TYPE:
ShowError(GetMessage("CT_BMTS_WRONG_IBLOCK_TYPE"));
die;
case CListPermissions::WRONG_IBLOCK:
ShowError(GetMessage("CT_BMTS_WRONG_IBLOCK"));
die;
default:
ShowError(GetMessage("CT_BMTS_UNKNOWN_ERROR"));
die;
}
} elseif ($lists_perm < CListPermissions::CAN_READ && !CIBlockRights::UserHasRightTo($iblock_id, $iblock_id, "element_read")) {
ShowError(GetMessage("CT_BMTS_ACCESS_DENIED"));
die;
}
$arIBlock = CIBlock::GetArrayByID($iblock_id);
if ($_REQUEST['MODE'] == 'section') {
$arResult = array();
$SECTION_ID = intval($_REQUEST['SECTION_ID']);
//if($SECTION_ID == 0)
// $SECTION_ID = false;
$rsElements = CIBlockElement::GetList(array('ID' => 'ASC'), array('IBLOCK_ID' => $arIBlock["ID"], 'SECTION_ID' => $SECTION_ID, 'CHECK_PERMISSIONS' => $arParams['CAN_EDIT'] ? 'N' : 'Y'), false, false, array("ID", "NAME", "IBLOCK_SECTION_ID"));
while ($arElement = $rsElements->Fetch()) {
$arResult[] = array("ID" => $arElement["ID"], "NAME" => $arElement["NAME"], "SECTION_ID" => $arElement["IBLOCK_SECTION_ID"], "CONTENT" => '<div class="mts-name">' . htmlspecialcharsex($arElement["NAME"]) . '</div>');
}
$APPLICATION->RestartBuffer();
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
示例10: GetAllowableUserGroups
public function GetAllowableUserGroups($documentType)
{
$documentType = trim($documentType);
if (strlen($documentType) <= 0) {
return false;
}
$iblockId = intval(substr($documentType, strlen("iblock_")));
$arResult = array("Author" => GetMessage("IBD_DOCUMENT_AUTHOR"));
$arRes = array(1);
if (CIBlock::GetArrayByID($iblockId, "RIGHTS_MODE") === "E") {
$obRights = new CIBlockRights($iblockId);
foreach ($obRights->GetGroups() as $GROUP_CODE) {
if (preg_match("/^G(\\d+)\$/", $GROUP_CODE, $match)) {
$arRes[] = $match[1];
}
}
} else {
foreach (CIBlock::GetGroupPermissions($iblockId) as $groupId => $perm) {
if ($perm > "R") {
$arRes[] = $groupId;
}
}
}
$dbGroupsList = CGroup::GetListEx(array("NAME" => "ASC"), array("ID" => $arRes));
while ($arGroup = $dbGroupsList->Fetch()) {
$arResult[$arGroup["ID"]] = $arGroup["NAME"];
}
return $arResult;
}
示例11: unset
if (preg_match("/^G(\\d)\$/", $arRight["GROUP_CODE"], $match) && is_array($arListsPerm) && in_array($match[1], $arListsPerm)) {
unset($arResult["RIGHTS"][$RIGHT_ID]);
$arResult["SELECTED"][$arRight["GROUP_CODE"]] = true;
} else {
//2) protect groups with iblock_% operations
$arOperations = CTask::GetOperations($arRight['TASK_ID'], true);
foreach ($arOperations as $operation) {
if (preg_match("/^iblock_(?!admin)/", $operation)) {
unset($arResult["RIGHTS"][$RIGHT_ID]);
$arResult["SELECTED"][$arRight["GROUP_CODE"]] = true;
break;
}
}
}
}
$arResult["TASKS"] = CIBlockRights::GetRightsList();
foreach ($arResult["TASKS"] as $TASK_ID => $label) {
//2) protect tasks with iblock_% operations
$arOperations = CTask::GetOperations($TASK_ID, true);
foreach ($arOperations as $operation) {
if (preg_match("/^iblock_(?!admin)/", $operation)) {
unset($arResult["TASKS"][$TASK_ID]);
break;
}
}
}
}
$arResult["VARS_FROM_FORM"] = $bVarsFromForm;
$arResult["FORM_DATA"] = array();
foreach ($data as $key => $value) {
$arResult["FORM_DATA"]["~" . $key] = $value;
示例12: array
BX.WindowManager.Get().Close();
if(window.reloadAfterClose)
top.BX.reload(true);
}
}";
$tabControl->ButtonsPublic(array(
'.btnSave',
($ID > 0 && $bWorkflow? $wfClose: $cancel),
$save_and_add,
));
endif;
$tabControl->Show();
if (
(!defined('BX_PUBLIC_MODE') || BX_PUBLIC_MODE != 1)
&& CIBlockRights::UserHasRightTo($IBLOCK_ID, $IBLOCK_ID, "iblock_edit")
&& !$bAutocomplete
)
{
echo
BeginNote(),
GetMessage("IBEL_E_IBLOCK_MANAGE_HINT"),
' <a href="/bitrix/admin/iblock_edit.php?type='.htmlspecialcharsbx($type).'&lang='.LANGUAGE_ID.'&ID='.$IBLOCK_ID.'&admin=Y&return_url='.urlencode("/bitrix/admin/".CIBlock::GetAdminElementEditLink($IBLOCK_ID, $ID, array("WF" => ($WF=="Y"? "Y": null), "find_section_section" => intval($find_section_section), "return_url" => (strlen($return_url)>0? $return_url: null)))).'">',
GetMessage("IBEL_E_IBLOCK_MANAGE_HINT_HREF"),
'</a>',
EndNote()
;
}
//////////////////////////
//END of the custom form
示例13: ReSort
public static function ReSort($IBLOCK_ID, $ID = 0, $cnt = 0, $depth = 0, $ACTIVE = "Y")
{
$cnt = self::TreeReSort($IBLOCK_ID, $ID, $cnt, $depth, $ACTIVE);
$obIBlockRights = new CIBlockRights($IBLOCK_ID);
$obIBlockRights->Recalculate();
return $cnt;
}
示例14: GetMessage
if (is_array($arCatalog))
{
$arPropLinks = CIBlockSectionPropertyLink::GetArray($arCatalog["IBLOCK_ID"], 0);
?>
<tr colspan="2" class="heading">
<td align="center"><?echo GetMessage("CAT_CEDIT_PROP_SKU_SECTION");?></td>
</tr>
<tr colspan="2"><td align="center">
<table class="internal" id="table_SKU_SECTION_PROPERTY">
<tr class="heading">
<td><?echo GetMessage("CAT_CEDIT_PROP_TABLE_NAME");?></td>
<td><?echo GetMessage("CAT_CEDIT_PROP_TABLE_TYPE");?></td>
<td><?echo GetMessage("CAT_CEDIT_PROP_TABLE_SMART_FILTER");?></td>
<td><?echo GetMessage("CAT_CEDIT_PROP_TABLE_ACTION");?></td></tr>
<?
if(CIBlockRights::UserHasRightTo($arCatalog["IBLOCK_ID"], $arCatalog["IBLOCK_ID"], "iblock_edit"))
$arShadow = $arHidden = array(
-1 => GetMessage("CAT_CEDIT_PROP_SELECT_CHOOSE"),
0 => GetMessage("CAT_CEDIT_PROP_SELECT_CREATE"),
);
else
$arShadow = $arHidden = array(
-1 => GetMessage("CAT_CEDIT_PROP_SELECT_CHOOSE"),
);
$rsProps = CIBlockProperty::GetList(array(
"SORT"=>"ASC",
'ID' => 'ASC',
), array(
"IBLOCK_ID" => $arCatalog["IBLOCK_ID"],
"CHECK_PERMISSIONS" => "N",
示例15: IncludeModuleLangFile
<?php
/** @global CMain $APPLICATION */
/** @global CDatabase $DB */
use Bitrix\Main\Loader, Bitrix\Main, Bitrix\Iblock;
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
Loader::includeModule('iblock');
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/iblock/prolog.php";
IncludeModuleLangFile(__FILE__);
$arIBlock = CIBlock::GetArrayByID($_GET["IBLOCK_ID"]);
if (!is_array($arIBlock)) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
if (!CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$simpleTypeList = array(Iblock\PropertyTable::TYPE_STRING => true, Iblock\PropertyTable::TYPE_NUMBER => true, Iblock\PropertyTable::TYPE_LIST => true, Iblock\PropertyTable::TYPE_FILE => true, Iblock\PropertyTable::TYPE_SECTION => true, Iblock\PropertyTable::TYPE_ELEMENT => true);
$sTableID = "tbl_iblock_property_admin_" . $arIBlock["ID"];
$oSort = new CAdminSorting($sTableID, 'SORT', 'ASC');
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array("find_name", "find_code", "find_active", "find_searchable", "find_filtrable", "find_is_required", "find_multiple", "find_xml_id", "find_property_type");
$lAdmin->InitFilter($arFilterFields);
$arFilter = array("=IBLOCK_ID" => $arIBlock["ID"], "?NAME" => $find_name, "?CODE" => $find_code, "=ACTIVE" => $find_active, "=SEARCHABLE" => $find_searchable, "=FILTRABLE" => $find_filtrable, "=XML_ID" => $find_xml_id, "=PROPERTY_TYPE" => $find_property_type, "=IS_REQUIRED" => $find_is_required, "=MULTIPLE" => $find_multiple);
foreach ($arFilter as $key => $value) {
if (!strlen(trim($value))) {
unset($arFilter[$key]);
}
}
if (isset($arFilter['=PROPERTY_TYPE'])) {
if (!isset($simpleTypeList[$arFilter['=PROPERTY_TYPE']])) {
list($arFilter['=PROPERTY_TYPE'], $arFilter['=USER_TYPE']) = explode(':', $arFilter['=PROPERTY_TYPE'], 2);