本文整理汇总了PHP中CIBlockSectionRights::GetRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockSectionRights::GetRights方法的具体用法?PHP CIBlockSectionRights::GetRights怎么用?PHP CIBlockSectionRights::GetRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockSectionRights
的用法示例。
在下文中一共展示了CIBlockSectionRights::GetRights方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateSharedFolder
public static function CreateSharedFolder($iblockID, $sectionID, $userID, $setRights = false)
{
$_sharedGroup = 'AU';
$_sharedTask = 'R';
$_shareName = GetMessage("WD_SHARED_FILES");
$_shareXMLID = 'SHARED_FOLDER';
$arTasks = CWebDavIblock::GetTasks();
$arFilter = array("IBLOCK_ID" => $iblockID, "SECTION_ID" => $sectionID, "CHECK_PERMISSIONS" => "N");
$_shareRights = array("n0" => array("GROUP_CODE" => $_sharedGroup, "TASK_ID" => $arTasks[$_sharedTask]));
$arShare = null;
$se = new CIBlockSection();
$arFilter['NAME'] = $_shareName;
$dbShare = CIBlockSection::GetList(array(), $arFilter, false, array('ID', 'CREATED_BY', 'MODIFIED_BY', 'XML_ID'));
if ($dbShare && ($arShare1 = $dbShare->Fetch())) {
$arShare =& $arShare1;
} else {
unset($arFilter['NAME']);
// search for renamed shared folder
$arFilter['XML_ID'] = $_shareXMLID;
$dbShare = CIBlockSection::GetList(array(), $arFilter, false, array('ID', 'CREATED_BY', 'XML_ID'));
if ($dbShare && ($arShare2 = $dbShare->Fetch())) {
$arShare =& $arShare2;
}
}
if ($arShare) {
if ($setRights) {
$sRight = new CIBlockSectionRights($iblockID, $arShare['ID']);
$arRights = $sRight->GetRights($arShare['ID']);
$validRights = false;
foreach ($arRights as $right) {
if ($right['GROUP_CODE'] == $_sharedGroup && $right['TASK_ID'] == $arTasks[$_sharedTask]) {
$validRights = true;
break;
}
}
if (!$validRights) {
$sRight->SetRights($_shareRights);
}
}
$recoverData = array();
if ($arShare['XML_ID'] != $_shareXMLID) {
$recoverData['XML_ID'] = $_shareXMLID;
}
if ($arShare['CREATED_BY'] != $userID) {
$recoverData['CREATED_BY'] = $userID;
}
if ($arShare['MODIFIED_BY'] != $userID) {
$recoverData['MODIFIED_BY'] = $userID;
}
if (!empty($recoverData)) {
$se->Update($arShare['ID'], $recoverData);
}
} else {
$arFilter['NAME'] = $_shareName;
$arFilter["RIGHTS"] = $_shareRights;
$arFilter['IBLOCK_SECTION_ID'] = $arFilter['SECTION_ID'];
$arFilter["CREATED_BY"] = $userID;
$arFilter["MODIFIED_BY"] = $userID;
$arFilter['XML_ID'] = $_shareXMLID;
$newSecID = $se->Add($arFilter);
$obSectionRights = new CIBlockSectionRights($iblockID, $newSecID);
$obSectionRights->SetRights($arFilter["RIGHTS"]);
}
}
示例2: CIBlockSectionRights
}
else
{
$obRights = new CIBlockSectionRights($IBLOCK_ID, $MENU_SECTION_ID);
$htmlHidden = '';
}
$tabControl->BeginCustomField("RIGHTS", GetMessage("IBEL_E_RIGHTS_FIELD"));
IBlockShowRights(
'element',
$IBLOCK_ID,
$ID,
GetMessage("IBEL_E_RIGHTS_SECTION_TITLE"),
"RIGHTS",
$obRights->GetRightsList(),
$obRights->GetRights(array("count_overwrited" => true, "parents" => $str_IBLOCK_ELEMENT_SECTION)),
false, /*$bForceInherited=*/($ID <= 0) || $bCopy
);
$tabControl->EndCustomField("RIGHTS", $htmlHidden);
endif;
$bDisabled =
($view=="Y")
|| ($bWorkflow && $prn_LOCK_STATUS=="red")
|| (
(($ID <= 0) || $bCopy)
&& !CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $MENU_SECTION_ID, "section_element_bind")
)
|| (
(($ID > 0) && !$bCopy)
&& !CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit")
示例3: array
} else {
$arResult["HIGHLIGHT"] = array("groups" => array("disabled" => true));
}
} else {
if ($arParams["SOCNET_GROUP_ID"]) {
$arResult["HIGHLIGHT"] = array("socnetgroup" => array("group_id" => $arParams["SOCNET_GROUP_ID"]));
} else {
$arResult["HIGHLIGHT"] = null;
}
}
if ($arResult["ELEMENT_ID"]) {
$obRights = new CIBlockElementRights($arResult["IBLOCK_ID"], $arResult["ELEMENT_ID"]);
} else {
$obRights = new CIBlockSectionRights($arResult["IBLOCK_ID"], intval($data["IBLOCK_SECTION_ID"]));
}
$arResult["RIGHTS"] = $obRights->GetRights(array("parents" => array($data["IBLOCK_SECTION_ID"])));
$arListsPerm = CLists::GetPermission($arParams["~IBLOCK_TYPE_ID"]);
foreach ($arResult["RIGHTS"] as $RIGHT_ID => $arRight) {
//1) protect groups from module settings
$match = array();
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;
示例4: CIBlockElementRights
if ($ID > 0) {
$obRights = new CIBlockElementRights($IBLOCK_ID, $ID);
$htmlHidden = '';
foreach ($obRights->GetRights() as $RIGHT_ID => $arRight) {
$htmlHidden .= '
<input type="hidden" name="SUB_RIGHTS[][RIGHT_ID]" value="' . htmlspecialcharsbx($RIGHT_ID) . '">
<input type="hidden" name="SUB_RIGHTS[][GROUP_CODE]" value="' . htmlspecialcharsbx($arRight["GROUP_CODE"]) . '">
<input type="hidden" name="SUB_RIGHTS[][TASK_ID]" value="' . htmlspecialcharsbx($arRight["TASK_ID"]) . '">
';
}
} else {
$obRights = new CIBlockSectionRights($IBLOCK_ID, 0);
$htmlHidden = '';
}
$tabControl->BeginCustomField("RIGHTS", GetMessage("IBEL_E_RIGHTS_FIELD"));
IBlockShowRights('element', $IBLOCK_ID, $ID, GetMessage("IBEL_E_RIGHTS_SECTION_TITLE"), "SUB_RIGHTS", $obRights->GetRightsList(), $obRights->GetRights(array("count_overwrited" => true, "parents" => array())), false, $ID <= 0 || $bCopy);
$tabControl->EndCustomField("RIGHTS", $htmlHidden);
}
$bDisabled = $view == "Y" || $bWorkflow && $prn_LOCK_STATUS == "red" || ($ID <= 0 || $bCopy) && !CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, 0, "section_element_bind") || $ID > 0 && !$bCopy && !CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit") || $bBizproc && !$canWrite;
if ($ID > 0 && !$bSubCopy && BX_SUB_SETTINGS) {
if (!$ajaxReload) {
$reloadParams = array('bxpublic' => 'Y', 'bxsku' => 'Y', 'WF' => 'Y', 'TMP_ID' => $strSubTMP_ID, 'ajaxReload' => 'Y');
if ($arShowTabs['product_group']) {
$reloadParams['groupdel'] = 'Y';
$reloadParams['sessid'] = bitrix_sessid();
$setBtn = "{\n\t\t\t\ttitle: '" . CUtil::JSEscape(GetMessage('IB_SE_SET_PRODUCT_TYPE_GROUP_DELETE')) . "',\n\t\t\t\tname: 'groupdel',\n\t\t\t\tid: 'groupdel',\n\t\t\t\tclassName: 'adm-btn-add',\n\t\t\t\taction: function () {\n\t\t\t\t\tif (confirm('" . CUtil::JSEscape(GetMessage('IB_SE_SET_PRODUCT_TYPE_GROUP_DELETE_CONFIRM')) . "'))\n\t\t\t\t\t{\n\t\t\t\t\t\ttop.BX.showWait();\n\t\t\t\t\t\ttop.BX.ajax.get(\n\t\t\t\t\t\t\t'" . CIBlock::GetAdminSubElementEditLink($IBLOCK_ID, $intProductID, $ID, $reloadParams, '', true) . "',\n\t\t\t\t\t\t\tfunction (result) {\n\t\t\t\t\t\t\t\ttop.BX.closeWait();\n\t\t\t\t\t\t\t\ttop.BX.WindowManager.Get().SetContent(result);\n\t\t\t\t\t\t\t\tif (BX('groupdel'))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tBX.style(BX('groupdel'), 'display', 'none');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}";
} else {
$reloadParams['SUBPRODUCT_TYPE'] = CCatalogAdminTools::TAB_GROUP;
$setBtn = "{\n\t\t\t\ttitle: '" . CUtil::JSEscape(GetMessage('IB_SE_SET_PRODUCT_TYPE_GROUP_ADD')) . "',\n\t\t\t\tname: 'groupset',\n\t\t\t\tid: 'groupset',\n\t\t\t\tclassName: 'adm-btn-add',\n\t\t\t\taction: function () {\n\t\t\t\t\ttop.BX.showWait();\n\t\t\t\t\ttop.BX.ajax.get('" . CIBlock::GetAdminSubElementEditLink($IBLOCK_ID, $intProductID, $ID, $reloadParams, '', true) . "',\n\t\t\t\t\tfunction (result) {\n\t\t\t\t\t\ttop.BX.closeWait();\n\t\t\t\t\t\ttop.BX.WindowManager.Get().SetContent(result);\n\t\t\t\t\t\tif (BX('groupset'))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tBX.style(BX('groupset'), 'display', 'none');\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}";
}
$tabControl->ButtonsPublic(array($setBtn));
示例5: CIBlockSectionRights
if ($ID > 0) {
$obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $ID);
$htmlHidden = '';
foreach ($obSectionRights->GetRights() as $RIGHT_ID => $arRight) {
$htmlHidden .= '
<input type="hidden" name="RIGHTS[][RIGHT_ID]" value="' . htmlspecialcharsbx($RIGHT_ID) . '">
<input type="hidden" name="RIGHTS[][GROUP_CODE]" value="' . htmlspecialcharsbx($arRight["GROUP_CODE"]) . '">
<input type="hidden" name="RIGHTS[][TASK_ID]" value="' . htmlspecialcharsbx($arRight["TASK_ID"]) . '">
';
}
} else {
$obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $str_IBLOCK_SECTION_ID);
$htmlHidden = '';
}
$tabControl->BeginCustomField("RIGHTS", GetMessage("IBSEC_E_RIGHTS_FIELD"));
IBlockShowRights('section', $IBLOCK_ID, $ID, GetMessage("IBSEC_E_RIGHTS_SECTION_TITLE"), "RIGHTS", $obSectionRights->GetRightsList(), $obSectionRights->GetRights(array("count_overwrited" => true, "parent" => $str_IBLOCK_SECTION_ID)), true, $ID <= 0);
$tabControl->EndCustomField("RIGHTS", $htmlHidden);
}
if ($arIBlock["SECTION_PROPERTY"] === "Y") {
$tabControl->BeginNextFormTab();
$tabControl->BeginCustomField("SECTION_PROPERTY", GetMessage("IBSEC_E_SECTION_PROPERTY_FIELD"));
?>
<tr><td align="right" colspan="2">
<a id="modeChangeToTree" href="javascript:setMode(BX('table_SECTION_PROPERTY'), 'tree')"><?php
echo GetMessage("IBSEC_E_PROP_TREE_MODE");
?>
</a>
<a id="modeChangeToFlat" style="display: none;" href="javascript:setMode(BX('table_SECTION_PROPERTY'), 'flat')"><?php
echo GetMessage("IBSEC_E_PROP_FLAT_MODE");
?>
</a>
示例6: GetRights
public function GetRights($arOptions = array())
{
global $DB;
$arResult = array();
if(
!isset($arOptions["operations"])
|| !is_array($arOptions["operations"])
|| empty($arOptions["operations"])
)
{
$rs = $DB->Query("
SELECT
BR.ID
,BR.GROUP_CODE
,BR.TASK_ID
,BR.DO_INHERIT
,ER.IS_INHERITED
,BR.XML_ID
,BR.ENTITY_TYPE
,BR.ENTITY_ID
FROM
b_iblock_element_right ER
INNER JOIN b_iblock_right BR ON BR.ID = ER.RIGHT_ID
WHERE
ER.IBLOCK_ID = ".$this->IBLOCK_ID."
AND ER.ELEMENT_ID = ".$this->id."
ORDER BY
BR.ID
");
}
elseif(
isset($arOptions["operations_mode"])
&& $arOptions["operations_mode"] == CIBlockRights::ALL_OPERATIONS
&& count($arOptions["operations"]) > 1
)
{
$arOperations = array_map(array($DB, "ForSQL"), $arOptions["operations"]);
$rs = $DB->Query("
SELECT
BR.ID, BR.GROUP_CODE, BR.TASK_ID, BR.DO_INHERIT, ER.IS_INHERITED, BR.XML_ID
FROM
b_iblock_element_right ER
INNER JOIN b_iblock_right BR ON BR.ID = ER.RIGHT_ID
INNER JOIN b_task_operation T ON T.TASK_ID = BR.TASK_ID
INNER JOIN b_operation O ON O.ID = T.OPERATION_ID
WHERE
ER.IBLOCK_ID = ".$this->IBLOCK_ID."
AND ER.ELEMENT_ID = ".$this->id."
AND O.NAME IN ('".implode("', '", $arOperations)."')
GROUP BY
BR.ID, BR.GROUP_CODE, BR.TASK_ID, BR.DO_INHERIT, ER.IS_INHERITED
HAVING
COUNT(DISTINCT O.ID) = ".count($arOperations)."
ORDER BY
BR.ID
");
}
else//if($opMode == CIBlockRights::ANY_OPERATION)
{
$arOperations = array_map(array($DB, "ForSQL"), $arOptions["operations"]);
$rs = $DB->Query("
SELECT DISTINCT
BR.ID, BR.GROUP_CODE, BR.TASK_ID, BR.DO_INHERIT, ER.IS_INHERITED, BR.XML_ID
FROM
b_iblock_element_right ER
INNER JOIN b_iblock_right BR ON BR.ID = ER.RIGHT_ID
INNER JOIN b_task_operation T ON T.TASK_ID = BR.TASK_ID
INNER JOIN b_operation O ON O.ID = T.OPERATION_ID
WHERE
ER.IBLOCK_ID = ".$this->IBLOCK_ID."
AND ER.ELEMENT_ID = ".$this->id."
AND O.NAME IN ('".implode("', '", $arOperations)."')
ORDER BY
BR.ID
");
}
if(isset($arOptions["parents"]) && is_array($arOptions["parents"]))
{
foreach($arOptions["parents"] as $parent)
{
$obParentRights = new CIBlockSectionRights($this->IBLOCK_ID, $parent);
$arParentRights = $obParentRights->GetRights();
foreach($arParentRights as $RIGHT_ID => $arRight)
{
$arResult[$RIGHT_ID] = array(
"GROUP_CODE" => $arRight["GROUP_CODE"],
"DO_INHERIT" => $arRight["DO_INHERIT"],
"IS_INHERITED" => "Y",
"IS_OVERWRITED" => "Y",
"TASK_ID" => $arRight["TASK_ID"],
"XML_ID" => $arRight["XML_ID"],
);
if(isset($arRight["ENTITY_TYPE"]))
$arResult[$RIGHT_ID]["ENTITY_TYPE"] = $arRight["ENTITY_TYPE"];
if(isset($arRight["ENTITY_ID"]))
$arResult[$RIGHT_ID]["ENTITY_ID"] = $arRight["ENTITY_ID"];
}
}
//.........这里部分代码省略.........
示例7: CIBlockSectionRights
}
else
{
$obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $str_IBLOCK_SECTION_ID);
$htmlHidden = '';
}
$tabControl->BeginCustomField("RIGHTS", GetMessage("IBSEC_E_RIGHTS_FIELD"));
IBlockShowRights(
'section',
$IBLOCK_ID,
$ID,
GetMessage("IBSEC_E_RIGHTS_SECTION_TITLE"),
"RIGHTS",
$obSectionRights->GetRightsList(),
$obSectionRights->GetRights(array("count_overwrited" => true, "parent" => $str_IBLOCK_SECTION_ID)),
true, /*$bForceInherited=*/($ID <= 0)
);
$tabControl->EndCustomField("RIGHTS", $htmlHidden);
}
if($arIBlock["SECTION_PROPERTY"] === "Y")
{
$tabControl->BeginNextFormTab();
$tabControl->BeginCustomField("SECTION_PROPERTY", GetMessage("IBSEC_E_SECTION_PROPERTY_FIELD"));
?>
<tr><td align="right" colspan="2">
<a id="modeChangeToTree" href="javascript:setMode(BX('table_SECTION_PROPERTY'), 'tree')"><?echo GetMessage("IBSEC_E_PROP_TREE_MODE");?></a>
<a id="modeChangeToFlat" style="display: none;" href="javascript:setMode(BX('table_SECTION_PROPERTY'), 'flat')"><?echo GetMessage("IBSEC_E_PROP_FLAT_MODE");?></a>
</td></tr>
<tr><td align="center" colspan="2">
示例8: CIBlockSectionRights
}
else
{
$obRights = new CIBlockSectionRights($IBLOCK_ID, 0);
$htmlHidden = '';
}
$tabControl->BeginCustomField("RIGHTS", GetMessage("IBEL_E_RIGHTS_FIELD"));
IBlockShowRights(
'element',
$IBLOCK_ID,
$ID,
GetMessage("IBEL_E_RIGHTS_SECTION_TITLE"),
"SUB_RIGHTS",
$obRights->GetRightsList(),
$obRights->GetRights(array("count_overwrited" => true, "parents" => array())),
false, /*$bForceInherited=*/($ID <= 0) || $bCopy
);
$tabControl->EndCustomField("RIGHTS", $htmlHidden);
endif;
$bDisabled =
($view=="Y")
|| ($bWorkflow && $prn_LOCK_STATUS=="red")
|| (
(($ID <= 0) || $bCopy)
&& !CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, 0, "section_element_bind")
)
|| (
(($ID > 0) && !$bCopy)
&& !CIBlockElementRights::UserHasRightTo($IBLOCK_ID, $ID, "element_edit")