本文整理汇总了PHP中CIBlockRights::setRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockRights::setRights方法的具体用法?PHP CIBlockRights::setRights怎么用?PHP CIBlockRights::setRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockRights
的用法示例。
在下文中一共展示了CIBlockRights::setRights方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processActionSetDelegateResponsible
protected function processActionSetDelegateResponsible()
{
$this->checkRequiredPostParams(array('iblockId'));
if (!Loader::includeModule('iblock')) {
$this->errorCollection->add(array(new Error(Loc::getMessage('LISTS_SEAC_CONNECTION_MODULE_IBLOCK'))));
}
$this->iblockId = intval($this->request->getPost('iblockId'));
$this->iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
$this->checkPermission();
if ($this->errorCollection->hasErrors()) {
$this->sendJsonErrorResponse();
}
$selectUsers = $this->request->getPost('selectUsers');
$rightObject = new CIBlockRights($this->iblockId);
$rights = $rightObject->getRights();
$rightsList = $rightObject->getRightsList(false);
$idRight = array_search('iblock_full', $rightsList);
foreach ($rights as $keyRight => $right) {
$res = strpos($right['GROUP_CODE'], 'U');
if ($res === 0) {
$arraySearch = array_search($right['GROUP_CODE'], $selectUsers);
if ($right['TASK_ID'] == $idRight) {
if (!empty($selectUsers)) {
if ($arraySearch || $arraySearch == 0) {
unset($rights[$keyRight]);
}
} else {
unset($rights[$keyRight]);
}
} else {
if (!empty($selectUsers)) {
if ($arraySearch || $arraySearch == 0) {
unset($rights[$keyRight]);
}
}
}
}
}
if (!empty($selectUsers)) {
foreach ($selectUsers as $keySelect => $idUser) {
$rights['n' . $keySelect] = array('GROUP_CODE' => $idUser, 'TASK_ID' => $idRight);
}
}
$rightObject->setRights($rights);
$this->sendJsonSuccessResponse(array('message' => Loc::getMessage('LISTS_SEAC_MESSAGE_DELEGATE_RESPONSIBLE')));
}
示例2: createIBlockRights
/**
* @param int $iblockId This variable is the id iblock.
*/
private static function createIBlockRights($iblockId)
{
$rightObject = new \CIBlockRights($iblockId);
$rights = $rightObject->getRights();
$rightsList = $rightObject->getRightsList(false);
$rightId = array_search('iblock_full', $rightsList);
$rights['n0'] = array('GROUP_CODE' => "G1", 'TASK_ID' => $rightId);
$rights['n1'] = array('GROUP_CODE' => "U1", 'TASK_ID' => $rightId);
$rightId = array_search('iblock_element_add', $rightsList);
$rights['n2'] = array('GROUP_CODE' => "G2", 'TASK_ID' => $rightId);
$rightObject->setRights($rights);
}