本文整理汇总了PHP中CIBlockRights::GetRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockRights::GetRights方法的具体用法?PHP CIBlockRights::GetRights怎么用?PHP CIBlockRights::GetRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockRights
的用法示例。
在下文中一共展示了CIBlockRights::GetRights方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetMessage
?>
<tr>
<td width="40%" class="adm-detail-valign-top"><label for="RIGHTS_MODE"><?php
echo GetMessage("IB_E_RIGHTS_MODE");
?>
</label></td>
<td width="60%">
<input type="hidden" name="RIGHTS_MODE" value="S">
<input type="checkbox" id="RIGHTS_MODE" name="RIGHTS_MODE" value="E" checked="checked"><?php
echo BeginNote(), GetMessage("IB_E_RIGHTS_MODE_NOTE1"), EndNote();
?>
</td>
</tr>
<?php
$obIBlockRights = new CIBlockRights($ID);
IBlockShowRights('iblock', $ID, $ID, GetMessage("IB_E_RIGHTS_SECTION_TITLE"), "RIGHTS", $obIBlockRights->GetRightsList(), $obIBlockRights->GetRights(array("count_overwrited" => true)), true);
?>
<tr>
<td colspan="2"> </td>
</tr>
<?php
} else {
?>
<tr>
<td width="40%" class="adm-detail-valign-top"><label for="RIGHTS_MODE"><?php
echo GetMessage("IB_E_RIGHTS_MODE");
?>
</label></td>
<td width="60%">
<input type="hidden" name="RIGHTS_MODE" value="S">
<input type="checkbox" id="RIGHTS_MODE" name="RIGHTS_MODE" value="E"><?php
示例2: array
$arResult["RIGHTS"]['n' . $i++] = array("GROUP_CODE" => "AU", "IS_INHERITED" => "N", "TASK_ID" => CIBlockRights::LetterToTask($permission));
break;
case "N":
$arResult["RIGHTS"]['n' . $i++] = array("GROUP_CODE" => "G2", "IS_INHERITED" => "N", "TASK_ID" => CIBlockRights::LetterToTask($permission));
break;
}
}
} else {
$arIBlockPerms = CIBlock::GetGroupPermissions($arResult["IBLOCK_ID"]);
foreach ($arIBlockPerms as $group_id => $letter) {
$arResult["RIGHTS"]['n' . $i++] = array("GROUP_CODE" => "G" . $group_id, "IS_INHERITED" => "N", "TASK_ID" => CIBlockRights::LetterToTask($letter));
}
}
} elseif ($arResult["IBLOCK_ID"] > 0) {
$obIBlockRights = new CIBlockRights($arResult["IBLOCK_ID"]);
$arResult["RIGHTS"] = $obIBlockRights->GetRights(array("count_overwrited" => true));
}
$arListsPerm = CLists::GetPermission($arParams["~IBLOCK_TYPE_ID"]);
foreach ($arResult["RIGHTS"] as $RIGHT_ID => $arRight) {
//1) protect groups from module settings
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;
示例3: GetMessage
<td width="40%" class="adm-detail-valign-top"><label for="RIGHTS_MODE"><?echo GetMessage("IB_E_RIGHTS_MODE")?></label></td>
<td width="60%">
<input type="hidden" name="RIGHTS_MODE" value="S">
<input type="checkbox" id="RIGHTS_MODE" name="RIGHTS_MODE" value="E" checked="checked"><?echo BeginNote(), GetMessage("IB_E_RIGHTS_MODE_NOTE1"), EndNote()?>
</td>
</tr>
<?
$obIBlockRights = new CIBlockRights($ID);
IBlockShowRights(
'iblock',
$ID,
$ID,
GetMessage("IB_E_RIGHTS_SECTION_TITLE"),
"RIGHTS",
$obIBlockRights->GetRightsList(),
$obIBlockRights->GetRights(array("count_overwrited" => true)),
true
);
?>
<tr>
<td colspan="2"> </td>
</tr>
<?else:?>
<tr>
<td width="40%" class="adm-detail-valign-top"><label for="RIGHTS_MODE"><?echo GetMessage("IB_E_RIGHTS_MODE")?></label></td>
<td width="60%">
<input type="hidden" name="RIGHTS_MODE" value="S">
<input type="checkbox" id="RIGHTS_MODE" name="RIGHTS_MODE" value="E"><?echo BeginNote(), GetMessage("IB_E_RIGHTS_MODE_NOTE2"), EndNote()?>
</td>
</tr>
<?
示例4: GetRights
public function GetRights($arOptions = array())
{
global $DB;
$arResult = array();
if($this->id <= 0)
return parent::GetRights($arOptions);
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
,SR.IS_INHERITED
,BR.XML_ID
,BR.ENTITY_TYPE
,BR.ENTITY_ID
FROM
b_iblock_section_right SR
INNER JOIN b_iblock_right BR ON BR.ID = SR.RIGHT_ID
WHERE
SR.IBLOCK_ID = ".$this->IBLOCK_ID."
AND SR.SECTION_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, SR.IS_INHERITED, BR.XML_ID
FROM
b_iblock_section_right SR
INNER JOIN b_iblock_right BR ON BR.ID = SR.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
SR.IBLOCK_ID = ".$this->IBLOCK_ID."
AND SR.SECTION_ID = ".$this->id."
AND O.NAME IN ('".implode("', '", $arOperations)."')
GROUP BY
BR.ID, BR.GROUP_CODE, BR.TASK_ID, BR.DO_INHERIT, SR.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, SR.IS_INHERITED, BR.XML_ID
FROM
b_iblock_section_right SR
INNER JOIN b_iblock_right BR ON BR.ID = SR.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
SR.IBLOCK_ID = ".$this->IBLOCK_ID."
AND SR.SECTION_ID = ".$this->id."
AND O.NAME IN ('".implode("', '", $arOperations)."')
ORDER BY
BR.ID
");
}
if(isset($arOptions["parent"]))
{
$obParentRights = new CIBlockSectionRights($this->IBLOCK_ID, $arOptions["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"];
}
//.........这里部分代码省略.........
示例5: removeRights
public static function removeRights(CIBlockRights $ibRights, array $removedRights, array $tasks)
{
$taskIdToLetter = array_flip($tasks);
$letterToTaskId = $tasks;
$newRights = array();
$existsRights = $ibRights->GetRights();
$removedRightsGroupCode = array();
foreach ($removedRights as $k => $right) {
$removedRightsGroupCode[$right['GROUP_CODE']] = $k;
}
unset($right);
foreach ($existsRights as $existsRight) {
if (!empty($removedRightsGroupCode[$existsRight['GROUP_CODE']]) && $existsRight['IS_INHERITED'] != 'Y') {
$keyOfAppendRight = $removedRightsGroupCode[$existsRight['GROUP_CODE']];
//if new right == exists right, remove this
if ($taskIdToLetter[$removedRights[$keyOfAppendRight]['TASK_ID']] == $taskIdToLetter[$existsRight['TASK_ID']]) {
continue;
} else {
$newRights[] = array('GROUP_CODE' => $existsRight['GROUP_CODE'], 'TASK_ID' => $existsRight['TASK_ID']);
}
unset($removedRights[$keyOfAppendRight]);
} else {
$newRights[] = array('GROUP_CODE' => $existsRight['GROUP_CODE'], 'TASK_ID' => $existsRight['TASK_ID']);
}
}
unset($existsRight);
$returnRights = array();
$i = 0;
foreach ($newRights as $right) {
$returnRights['n' . $i++] = $right;
}
unset($right);
return $returnRights;
}