本文整理汇总了PHP中CIBlockElementRights::getRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockElementRights::getRights方法的具体用法?PHP CIBlockElementRights::getRights怎么用?PHP CIBlockElementRights::getRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockElementRights
的用法示例。
在下文中一共展示了CIBlockElementRights::getRights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addFilesRights
/**
* Add rights for reading files by given users.
* @deprecated
*/
private static function addFilesRights($taskId, $arFilesIds)
{
$arFilesIds = array_unique(array_filter($arFilesIds));
// Nothing to do?
if (empty($arFilesIds)) {
return;
}
if (!CModule::IncludeModule('webdav')) {
return;
}
$arRightsTasks = CWebDavIblock::GetTasks();
// tasks-operations
$oTask = new CTaskItem((int) $taskId, 1);
$arTask = $oTask->getData(false);
$arTaskMembers = array_unique(array_merge(array($arTask['CREATED_BY'], $arTask['RESPONSIBLE_ID']), $arTask['AUDITORS'], $arTask['ACCOMPLICES']));
$ibe = new CIBlockElement();
$dbWDFile = $ibe->GetList(array(), array('ID' => $arFilesIds, 'SHOW_NEW' => 'Y'), false, false, array('ID', 'NAME', 'SECTION_ID', 'IBLOCK_ID', 'WF_NEW'));
if ($dbWDFile) {
$i = 0;
$arRightsForTaskMembers = array();
foreach ($arTaskMembers as $userId) {
// For intranet users and their managers
$arRightsForTaskMembers['n' . $i++] = array('GROUP_CODE' => 'IU' . $userId, 'TASK_ID' => $arRightsTasks['R']);
// For extranet users
$arRightsForTaskMembers['n' . $i++] = array('GROUP_CODE' => 'U' . $userId, 'TASK_ID' => $arRightsTasks['R']);
}
$iNext = $i;
while ($arWDFile = $dbWDFile->Fetch()) {
if (!$arWDFile['IBLOCK_ID']) {
continue;
}
$fileId = $arWDFile['ID'];
if (CIBlock::GetArrayByID($arWDFile['IBLOCK_ID'], "RIGHTS_MODE") === "E") {
$ibRights = new CIBlockElementRights($arWDFile['IBLOCK_ID'], $fileId);
$arCurRightsRaw = $ibRights->getRights();
// Preserve existing rights
$i = $iNext;
$arRights = $arRightsForTaskMembers;
foreach ($arCurRightsRaw as $arRightsData) {
$arRights['n' . $i++] = array('GROUP_CODE' => $arRightsData['GROUP_CODE'], 'TASK_ID' => $arRightsData['TASK_ID']);
}
$ibRights->setRights($arRights);
}
}
}
}