本文整理汇总了PHP中CIBlock::GetGroupPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlock::GetGroupPermissions方法的具体用法?PHP CIBlock::GetGroupPermissions怎么用?PHP CIBlock::GetGroupPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlock
的用法示例。
在下文中一共展示了CIBlock::GetGroupPermissions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUserGroupId
/**
* Установка групп пользователей
*
* @param $id : ID Информационного блока
* @param $item : Формируемый массив
*/
private function setUserGroupId($id, &$item)
{
$item['GROUP_ID'] = $this->iblock->GetGroupPermissions($id);
$arGroups = Helper::getUserGroups();
foreach ($item['GROUP_ID'] as $groupId => $right) {
$groupCode = Helper::getUserGroupCode($groupId, $arGroups);
if ($groupCode != null && strlen($groupCode) > 0) {
$item['GROUP_ID'][$groupCode] = $item['GROUP_ID'][$groupId];
unset($item['GROUP_ID'][$groupId]);
}
}
}
示例2: array
$arIBlockType = array();
$rsIBlockType = CIBlockType::GetList(array("sort" => "asc"), array("ACTIVE" => "Y"));
while ($arr = $rsIBlockType->Fetch()) {
if ($ar = CIBlockType::GetByIDLang($arr["ID"], LANGUAGE_ID)) {
$arIBlockType[$arr["ID"]] = "[" . $arr["ID"] . "] " . $ar["~NAME"];
}
}
$arIBlock = array();
$rsIBlock = CIBlock::GetList(array("sort" => "asc"), array("TYPE" => $arCurrentValues["IBLOCK_TYPE"], "ACTIVE" => "Y"));
while ($arr = $rsIBlock->Fetch()) {
$arIBlock[$arr["ID"]] = "[" . $arr["ID"] . "] " . $arr["NAME"];
}
$arUGroupsEx = array();
$dbUGroups = CGroup::GetList($by = "c_sort", $order = "asc");
if ($arCurrentValues["IBLOCK_ID"] > 0) {
$arUGroupsExPermission = CIBlock::GetGroupPermissions($arCurrentValues["IBLOCK_ID"]);
}
while ($arUGroups = $dbUGroups->Fetch()) {
if ($arUGroups["ID"] == 2) {
continue;
}
$arUGroupsEx[$arUGroups["ID"]] = $arUGroups["NAME"] . "[" . $arUGroups["ID"] . "]";
}
$res = unserialize(COption::GetOptionString("photogallery", "pictures"));
$arSights = array();
if (is_array($res)) {
foreach ($res as $key => $val) {
$arSights[str_pad($key, 5, "_") . $val["code"]] = $val["title"];
}
}
$arFiles = array("" => "...");
示例3: GetMessage
}
if ($arResult["Step"] > 1 && !check_bitrix_sessid()) {
$arResult["Step"] = 1;
$arResult["ErrorMessage"] .= GetMessage("BPWC_WNC_SESSID") . ". ";
}
$runtime = CBPRuntime::GetRuntime();
$runtime->StartRuntime();
$documentService = $runtime->GetService("DocumentService");
$arResult["DocumentFields"] = $documentService->GetDocumentFields(array("bizproc", "CBPVirtualDocument", "type_" . intval($arParams["BLOCK_ID"])));
$arResult["Data"] = array("Name" => "", "Description" => "", "FilterableFields" => array(), "VisibleFields" => array(), "Sort" => 100, "Image" => 0, "ElementAdd" => GetMessage("BPWC_WNC_PNADD"), "UserGroups" => array(2), "Template" => "", "TemplateVariables" => array(), "ComponentTemplates" => array());
if ($arParams["BLOCK_ID"] > 0) {
$db = CIBlock::GetList(array(), array("ID" => $arParams["BLOCK_ID"], "TYPE" => $arParams["IBLOCK_TYPE"], "ACTIVE" => "Y"));
if ($ar = $db->Fetch()) {
$arMessagesTmp = CIBlock::GetMessages($ar["ID"]);
$arG = array();
$arP = CIBlock::GetGroupPermissions($ar["ID"]);
foreach ($arP as $key => $value) {
if ($value == "R") {
$arG[] = $key;
}
}
$v1 = $ar["DESCRIPTION"];
$v2 = array();
$v3 = array();
$v5 = array();
if (strlen($ar["DESCRIPTION"]) > 0 && substr($ar["DESCRIPTION"], 0, strlen("v2:")) == "v2:") {
$v4 = @unserialize(substr($ar["DESCRIPTION"], 3));
if (is_array($v4)) {
$v1 = $v4["DESCRIPTION"];
$v2 = is_array($v4["FILTERABLE_FIELDS"]) ? $v4["FILTERABLE_FIELDS"] : (strlen($v4["FILTERABLE_FIELDS"]) > 0 ? array($v4["FILTERABLE_FIELDS"]) : array());
$v3 = is_array($v4["VISIBLE_FIELDS"]) ? $v4["VISIBLE_FIELDS"] : (strlen($v4["VISIBLE_FIELDS"]) > 0 ? array($v4["VISIBLE_FIELDS"]) : array());
示例4: SetPermission
/**
* <p>Функция устанавливает права доступа <span class="syntax"><i>arPERMISSIONS</i> для информационного блока <i>IBLOCK_ID</i></span>. Перед этим все права установленные ранее снимаются. <br></p>
*
*
*
*
* @param int $IBLOCK_ID Код информационного блока.
*
*
*
* @param array $arPERMISSIONS Массив вида Array("код группы"=>"право доступа", ....), где <i>право
* доступа</i>: <br> D - доступ запрещён, <br> R - чтение, <br> U - редактирование
* через документооборот, <br> W - запись, <br> X - полный доступ (запись +
* назначение прав доступа на данный инфоблок).
*
*
*
* @return mixed
*
*
* <h4>Example</h4>
* <pre>
* <?<br>CIBlock::SetPermission($IBLOCK_ID, Array("1"=>"X", "2"=>"R", "3"=>"W"));<br>?>
* </pre>
*
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/index.php">CIBlock</a>::<a
* href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/getpermission.php">GetPermission()</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/index.php">CIBlock</a>::<a
* href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/update.php">Update()</a> </li> </ul><a
* name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblock/setpermission.php
* @author Bitrix
*/
public static function SetPermission($IBLOCK_ID, $arGROUP_ID)
{
/** @global CDatabase $DB */
global $DB;
$IBLOCK_ID = intval($IBLOCK_ID);
static $letters = "RUWX";
$arToDelete = array();
$arToInsert = array();
if (is_array($arGROUP_ID)) {
foreach ($arGROUP_ID as $group_id => $perm) {
$group_id = intval($group_id);
if ($group_id > 0 && strlen($perm) == 1 && strpos($letters, $perm) !== false) {
$arToInsert[$group_id] = $perm;
}
}
}
$rs = $DB->Query("\n\t\t\tSELECT GROUP_ID, PERMISSION\n\t\t\tFROM b_iblock_group\n\t\t\tWHERE IBLOCK_ID = " . $IBLOCK_ID . "\n\t\t", false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
while ($ar = $rs->Fetch()) {
$group_id = intval($ar["GROUP_ID"]);
if (isset($arToInsert[$group_id]) && $arToInsert[$group_id] === $ar["PERMISSION"]) {
unset($arToInsert[$group_id]);
//This already in DB
} else {
$arToDelete[] = $group_id;
}
}
if (!empty($arToDelete)) {
$DB->Query("\n\t\t\t\tDELETE FROM b_iblock_group\n\t\t\t\tWHERE IBLOCK_ID = " . $IBLOCK_ID . "\n\t\t\t\tAND GROUP_ID in (" . implode(", ", $arToDelete) . ")\n\t\t\t", false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
//And this should be deleted
}
if (!empty($arToInsert)) {
foreach ($arToInsert as $group_id => $perm) {
$DB->Query("\n\t\t\t\t\tINSERT INTO b_iblock_group(IBLOCK_ID, GROUP_ID, PERMISSION)\n\t\t\t\t\tSELECT " . $IBLOCK_ID . ", ID, '" . $perm . "'\n\t\t\t\t\tFROM b_group\n\t\t\t\t\tWHERE ID = " . $group_id . "\n\t\t\t\t");
}
}
if (!empty($arToDelete) || !empty($arToInsert)) {
if (CModule::IncludeModule("search")) {
$arGroups = CIBlock::GetGroupPermissions($IBLOCK_ID);
if (array_key_exists(2, $arGroups)) {
CSearch::ChangePermission("iblock", array(2), false, false, $IBLOCK_ID);
} else {
CSearch::ChangePermission("iblock", $arGroups, false, false, $IBLOCK_ID);
}
}
}
}
示例5: GetProductData
/**
* @param array $arParams
* @return array|false
*/
public static function GetProductData($arParams)
{
$adminSection = defined('ADMIN_SECTION') && ADMIN_SECTION === true;
if (!isset($arParams['QUANTITY']) || (double) $arParams['QUANTITY'] <= 0) {
$arParams['QUANTITY'] = 0;
}
$arParams['RENEWAL'] = isset($arParams['RENEWAL']) && $arParams['RENEWAL'] == 'Y' ? 'Y' : 'N';
$arParams['CHECK_QUANTITY'] = isset($arParams['CHECK_QUANTITY']) && $arParams["CHECK_QUANTITY"] == 'N' ? 'N' : 'Y';
$arParams['CHECK_PRICE'] = isset($arParams['CHECK_PRICE']) && $arParams['CHECK_PRICE'] == 'N' ? 'N' : 'Y';
$arParams['CHECK_COUPONS'] = isset($arParams['CHECK_COUPONS']) && $arParams['CHECK_COUPONS'] == 'N' ? 'N' : 'Y';
$arParams['CHECK_DISCOUNT'] = isset($arParams['CHECK_DISCOUNT']) && $arParams['CHECK_DISCOUNT'] == 'N' ? 'N' : 'Y';
$arParams['SELECT_QUANTITY_TRACE'] = isset($arParams['SELECT_QUANTITY_TRACE']) && $arParams['SELECT_QUANTITY_TRACE'] == 'Y' ? 'Y' : 'N';
$arParams['BASKET_ID'] = (string) (isset($arParams['BASKET_ID']) ? $arParams['BASKET_ID'] : '0');
$arParams['USER_ID'] = isset($arParams['USER_ID']) ? (int) $arParams['USER_ID'] : 0;
if ($arParams['USER_ID'] < 0) {
$arParams['USER_ID'] = 0;
}
$arParams['SITE_ID'] = isset($arParams['SITE_ID']) ? $arParams['SITE_ID'] : false;
$strSiteID = $arParams['SITE_ID'];
$arParams['CURRENCY'] = isset($arParams['CURRENCY']) ? Currency\CurrencyManager::checkCurrencyID($arParams['CURRENCY']) : false;
if ($arParams['CURRENCY'] === false) {
$arParams['CURRENCY'] = CSaleLang::GetLangCurrency($strSiteID ? $strSiteID : SITE_ID);
}
$productID = (int) $arParams['PRODUCT_ID'];
$quantity = (double) $arParams['QUANTITY'];
$intUserID = (int) $arParams['USER_ID'];
global $USER, $APPLICATION;
$arResult = array();
if ($adminSection) {
if (!($userGroups = static::getHitCache('USER_GROUPS', $intUserID))) {
$userGroups = self::getUserGroups($intUserID);
static::setHitCache('USER_GROUPS', $intUserID, $userGroups);
}
if (empty($userGroups)) {
return $arResult;
}
if (!($arProduct = static::getHitCache('IBLOCK_ELEMENT_PERM_N', $productID))) {
$dbIBlockElement = CIBlockElement::GetList(array(), array('ID' => $productID, 'ACTIVE' => 'Y', 'ACTIVE_DATE' => 'Y', 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'IBLOCK_ID', 'NAME', 'DETAIL_PAGE_URL'));
if ($arProduct = $dbIBlockElement->GetNext()) {
static::setHitCache('IBLOCK_ELEMENT_PERM_N', $productID, $arProduct);
}
unset($dbIBlockElement);
}
if (empty($arProduct) || !is_array($arProduct)) {
return $arResult;
}
if (!($iblockRights = static::getHitCache('IBLOCK_RIGHT', $arProduct['IBLOCK_ID']))) {
if ($iblockRights = CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'RIGHTS_MODE')) {
static::setHitCache('IBLOCK_RIGHT', $arProduct['IBLOCK_ID'], $iblockRights);
}
}
$extRights = $iblockRights == 'E';
if ($intUserID == 0) {
if ($extRights) {
$elementRights = new CIBlockElementRights($arProduct['IBLOCK_ID'], $arProduct['ID']);
$readList = $elementRights->GetRights(array('operations' => array('element_read')));
$disable = true;
if (!empty($readList) && is_array($readList)) {
foreach ($readList as &$row) {
if ($row['GROUP_CODE'] == 'G2') {
$disable = false;
break;
}
}
unset($row);
}
unset($readList, $elementRights);
if ($disable) {
return $arResult;
}
unset($disable);
} else {
$groupRights = CIBlock::GetGroupPermissions($arProduct['IBLOCK_ID']);
if (empty($groupRights) || !isset($groupRights[2]) || $groupRights[2] < 'R') {
return $arResult;
}
unset($groupRights);
}
} else {
if ($extRights) {
$proxyUserPermissionKey = $productID . "|" . $intUserID;
if (!($arUserRights = static::getHitCache('USER_RIGHT', $proxyUserPermissionKey))) {
if ($arUserRights = CIBlockElementRights::GetUserOperations($productID, $intUserID)) {
static::setHitCache('USER_RIGHT', $proxyUserPermissionKey, $arUserRights);
}
}
if (empty($arUserRights) || !isset($arUserRights['element_read'])) {
return $arResult;
}
unset($arUserRights);
} else {
static $permissions = array();
if (empty($permissions[$arProduct['IBLOCK_ID'] . "_" . $intUserID])) {
$permissions[$arProduct['IBLOCK_ID'] . "_" . $intUserID] = CIBlock::GetPermission($arProduct['IBLOCK_ID'], $intUserID);
}
if ($permissions < 'R') {
//.........这里部分代码省略.........
示例6: ReturnICal
function ReturnICal($arParams)
{
$calendarId = $arParams['calendarId'];
$userId = $arParams['userId'];
$sign = $arParams['sign'];
$arParams['ownerType'] = strtoupper($arParams['ownerType']);
$ownerType = isset($arParams['ownerType']) && in_array($arParams['ownerType'], array('GROUP', 'USER')) ? $arParams['ownerType'] : false;
$ownerId = isset($arParams['ownerId']) ? intVal($arParams['ownerId']) : $this->ownerId;
$iblockId = isset($arParams['iblockId']) && intVal($arParams['iblockId']) > 0 ? intVal($arParams['iblockId']) : $this->iblockId;
$GLOBALS['APPLICATION']->RestartBuffer();
if (!$this->CheckSign($sign, $userId, $calendarId)) {
return CEventCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED'));
}
$this->bCurUserOwner = $ownerType != 'USER' || $ownerId == $userId;
$privateStatus = CECCalendar::GetPrivateStatus($iblockId, $calendarId, $ownerType);
if (!$this->arCalenderIndex[$calendarId]) {
// For get events check
$this->arCalenderIndex[$calendarId] = array('PRIVATE_STATUS' => $privateStatus);
}
if ($this->bCache) {
$cache = new CPHPCache();
$cacheId = serialize(array($iblockId, $calendarId));
$cachePath = $this->cachePath . 'ical/';
if ($cache->InitCache($this->cacheTime, $cacheId, $cachePath)) {
$res = $cache->GetVars();
$iCalEvents = $res['iCalEvents'];
}
}
if (!$this->bCache || empty($iCalEvents)) {
// Get iblock permissions
$arGroups = CUser::GetUserGroup($userId);
$arGroupPerm = CIBlock::GetGroupPermissions($iblockId);
$maxPerm = 'D';
foreach ($arGroupPerm as $k => $perm) {
if (in_array($k, $arGroups) && $perm > $maxPerm) {
$maxPerm = $perm;
}
}
// Check permissions
if ($maxPerm < 'R' || $ownerType == 'USER' && (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $ownerId, "calendar") || !CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_USER, $ownerId, "calendar", 'view')) || $ownerType == 'GROUP' && (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $ownerId, "calendar") || !CSocNetFeaturesPerms::CanPerformOperation($userId, SONET_ENTITY_GROUP, $ownerId, "calendar", 'view'))) {
return CEventCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED'));
}
// === Fetch events from calendar ===
$r = CIBlockSection::GetList(array(), array("ID" => $calendarId, "CHECK_PERMISSIONS" => "N"));
if (!($arCal = $r->Fetch())) {
return CEventCalendar::ThrowError('INCORRECT CALENDAR ID');
}
$arExport = CECCalendar::GetExportParams($iblockId, $calendarId, $ownerType, $ownerId);
// LINK is incorrect, but we dont need for LINK...
if (!$arExport['ALLOW']) {
// Calendar is not accessible for export
return CEventCalendar::ThrowError(GetMessage('EC_ACCESS_DENIED'));
}
if ($arExport['SET'] == 'all') {
$bLoadAll = true;
$from_limit = $to_limit = false;
} else {
$bLoadAll = false;
if ($arExport['SET'] == '3_9') {
$ago = 3;
$future = 9;
} else {
$ago = 6;
$future = 12;
}
$from_limit = date(getDateFormat(false), mktime(0, 0, 0, date("m") - $ago, 1, date("Y")));
$to_limit = date(getDateFormat(false), mktime(0, 0, 0, date("m") + $future + 1, 1, date("Y")));
}
$arItems = $this->GetEvents(array('ownerType' => $ownerType, 'ownerId' => $ownerId, 'iblockId' => $iblockId, 'sectionId' => $calendarId, 'fromLimit' => $from_limit, 'toLimit' => $to_limit, 'bLoadAll' => $bLoadAll, 'arCalendarIds' => false, 'forExport' => true));
$iCalEvents = $this->FormatICal($arCal, $arItems);
if ($this->bCache) {
$cache->StartDataCache($this->cacheTime, $cacheId, $cachePath);
$cache->EndDataCache(array("iCalEvents" => $iCalEvents));
}
}
$this->ShowICalHeaders();
echo $iCalEvents;
exit;
}
示例7: GetAllowableUserGroups
public function GetAllowableUserGroups($documentType)
{
if ($storage = self::needProxyToDiskByDocType($documentType)) {
return self::proxyToDisk(__FUNCTION__, array(\Bitrix\Disk\BizProcDocumentCompatible::generateDocumentType($storage->getId())));
}
$iblockId = intval(substr($documentType, strlen("iblock_")));
if ($iblockId <= 0) {
throw new CBPArgumentOutOfRangeException("documentType", $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("element_bizproc_start") as $GROUP_CODE) {
if (preg_match("/^G(\\d+)\$/", $GROUP_CODE, $match)) {
$arRes[] = $match[1];
}
}
} else {
$arGroups = CIBlock::GetGroupPermissions($iblockId);
foreach ($arGroups as $groupId => $perm) {
if ($perm >= "R") {
$arRes[] = $groupId;
}
}
}
//Crutch for Bitrix24 context (user group management is not suppotted)
if (IsModuleInstalled('bitrix24')) {
$siteID = CAllSite::GetDefSite();
$dbResult = CGroup::GetList($by = '', $order = '', array('STRING_ID' => 'EMPLOYEES_' . $siteID, 'STRING_ID_EXACT_MATCH' => 'Y'));
if ($arEmployeeGroup = $dbResult->Fetch()) {
$employeeGroupID = intval($arEmployeeGroup['ID']);
if (!in_array($employeeGroupID, $arRes, true)) {
$arRes[] = $employeeGroupID;
}
}
}
$dbGroupsList = CGroup::GetListEx(array("NAME" => "ASC"), array("ID" => $arRes));
while ($arGroup = $dbGroupsList->Fetch()) {
$arResult[$arGroup["ID"]] = $arGroup["NAME"];
}
return $arResult;
}
示例8: 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;
}
示例9: run
//.........这里部分代码省略.........
}
if (isset($defs[$k]) && $defs[$k] == $data[$k]) {
unset($data[$k]);
}
}
$sites = '';
$res = \CIBlock::GetSite($id);
while ($row = $res->Fetch()) {
$sites .= $sites != '' ? ',' : '';
$sites .= "'" . $row['SITE_ID'] . "'";
}
unset($data['ELEMENTS_NAME']);
unset($data['ELEMENT_NAME']);
$sData = self::generateArrayExport($data, ' ');
$sDescription = self::generateSimpleStringFunctionText('description', $description, '');
$sDescriptionType = self::generateSimpleStringFunctionText('descriptionType', $descriptionType, 'text');
$sIsActive = self::generateSimpleStringFunctionText('isActive', $isactive, true);
$sSort = self::generateSimpleStringFunctionText('sort', $sort, '500');
$sSites = "\n\n public function sites()\n {\n return array({$sites});\n }";
$properties = array();
$result = \CIBlockProperty::GetList(array(), array('IBLOCK_ID' => $id, 'CHECK_PERMISSIONS' => 'N'));
$defs = array('VERSION' => '1', 'FILTRABLE' => 'N', 'SEARCHABLE' => 'N', 'LIST_TYPE' => 'L', 'COL_COUNT' => '30', 'ROW_COUNT' => '1', 'MULTIPLE' => 'N', 'SORT' => '500', 'IS_REQUIRED' => 'N', 'WITH_DESCRIPTION' => 'N', 'MULTIPLE_CNT' => '5');
while ($row = $result->Fetch()) {
$code = trim($row['CODE']);
if ($code == '') {
$code = 'PROP_' . $row['ID'];
}
$pid = $row['ID'];
unset($row['ID']);
unset($row['TIMESTAMP_X']);
unset($row['IBLOCK_ID']);
unset($row['ACTIVE']);
unset($row['CODE']);
foreach (array_keys($row) as $k) {
if (empty($row[$k])) {
unset($row[$k]);
}
if (isset($defs[$k]) && $defs[$k] == $row[$k]) {
unset($row[$k]);
}
}
if ($row['PROPERTY_TYPE'] == 'L') {
$items = array();
$res = \CIBlockPropertyEnum::GetList(array(), array('PROPERTY_ID' => $pid, 'CHECK_PERMISSIONS' => 'N'));
while ($lrow = $res->Fetch()) {
$iid = $lrow['ID'];
$eid = $lrow['EXTERNAL_ID'];
unset($lrow['ID']);
unset($lrow['EXTERNAL_ID']);
unset($lrow['XML_ID']);
unset($lrow['TMP_ID']);
unset($lrow['PROPERTY_ID']);
unset($lrow['PROPERTY_NAME']);
unset($lrow['PROPERTY_CODE']);
unset($lrow['PROPERTY_SORT']);
if ($lrow['SORT'] == '500') {
unset($lrow['SORT']);
}
if ($lrow['DEF'] == 'N') {
unset($lrow['DEF']);
}
if (count($lrow) == 1 && isset($lrow['VALUE'])) {
$lrow = $lrow['VALUE'];
}
$items[$eid] = $lrow;
}
$row['ITEMS'] = $items;
}
if (isset($row['LINK_IBLOCK_ID']) && !$forCache) {
$row['LINK_IBLOCK_CODE'] = \TAO::getInfoblockCode($row['LINK_IBLOCK_ID']);
unset($row['LINK_IBLOCK_ID']);
}
$properties[$code] = $row;
}
$sProperties = self::generateArrayExport($properties, ' ');
$messages = \CIBlock::GetMessages($id);
$sMessages = self::generateArrayExport($messages, ' ');
$fields = self::trimArrayValues(\CIBlock::GetFields($id));
$defFields = self::defaultFields();
foreach (array_keys($fields) as $field) {
if (isset($defFields[$field])) {
$md5 = md5(serialize($fields[$field]));
$def = md5(serialize($defFields[$field]));
if ($md5 == $def) {
//unset($fields[$field]);
} else {
//var_dump($fields[$field], $defFields[$field]);
}
}
}
$sFields = self::generateArrayExport($fields, ' ');
$permissions = \CIBlock::GetGroupPermissions($id);
$sPermissions = self::generateArrayExport($permissions, ' ');
ob_start();
include \TAO::taoDir() . '/views/template-iblock.phtml';
$content = "<?php\n" . ob_get_clean();
return $content;
}
return false;
}
示例10: 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;
}
示例11: switch
switch ($role) {
case "A":
case "E":
case "K":
$arResult["RIGHTS"]['n' . $i++] = array("GROUP_CODE" => "SG" . $arParams["SOCNET_GROUP_ID"] . "_" . $role, "IS_INHERITED" => "N", "TASK_ID" => CIBlockRights::LetterToTask($permission));
break;
case "L":
$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 {
示例12: array
else
$RUR = 'RUB';
$db_catalog_list = CCatalog::GetList(array(), array("YANDEX_EXPORT" => "Y", "PRODUCT_IBLOCK_ID" => 0), false, false, array('IBLOCK_ID'));
while ($arCatalog_list = $db_catalog_list->Fetch())
{
$arCatalog_list['IBLOCK_ID'] = intval($arCatalog_list['IBLOCK_ID']);
$arIBlock = CIBlock::GetArrayByID($arCatalog_list['IBLOCK_ID']);
if (empty($arIBlock) || !is_array($arIBlock))
continue;
if ('Y' != $arIBlock['ACTIVE'])
continue;
$boolRights = false;
if ('E' != $arIBlock['RIGHTS_MODE'])
{
$arRights = CIBlock::GetGroupPermissions($arCatalog_list['IBLOCK_ID']);
if (!empty($arRights) && isset($arRights[2]) && 'R' <= $arRights[2])
$boolRights = true;
}
else
{
$obRights = new CIBlockRights($arCatalog_list['IBLOCK_ID']);
$arRights = $obRights->GetGroups(array('section_read', 'element_read'));
if (!empty($arRights) && in_array('G2',$arRights))
$boolRights = true;
}
if (!$boolRights)
continue;
$filter = array("IBLOCK_ID"=>$arCatalog_list["IBLOCK_ID"], "ACTIVE"=>"Y", "GLOBAL_ACTIVE"=>"Y");
$db_acc = CIBlockSection::GetList(array("left_margin"=>"asc"), $filter);
示例13: GetReaders
static function GetReaders($ID, $iblockID = null)
{
static $arValidTasks = null;
static $readersCache = array();
$arReaders = array();
$ID = (int) $ID;
if ($ID <= 0) {
return $arReaders;
}
if (isset($readersCache[$ID])) {
return $readersCache[$ID];
}
if ($arValidTasks == null) {
$arTasks = CWebDavIblock::GetTasks();
$arValidTasks = array();
foreach ($arTasks as $taskLetter => $taskID) {
$arOperations = CTask::GetOperations($taskID, true);
if (array_search('element_read', $arOperations) !== false) {
$arValidTasks[$taskID] = true;
}
}
}
if ($iblockID === null) {
$rElement = CIBlockElement::GetList(array(), array('ID' => $ID, 'SHOW_NEW' => 'Y'), false, false, array('ID', 'IBLOCK_ID'));
if ($rElement && ($arElement = $rElement->Fetch())) {
$iblockID = $arElement['IBLOCK_ID'];
}
}
$iblockID = (int) $iblockID;
if ($iblockID <= 0) {
return $arReaders;
}
$bSocNet = CModule::IncludeModule('socialnetwork');
if (CIBlock::GetArrayByID($iblockID, "RIGHTS_MODE") === "E") {
$ibRights = new CIBlockElementRights($iblockID, $ID);
$arRights = $ibRights->GetRights();
foreach ($arRights as $rightID => $arRight) {
if (isset($arValidTasks[$arRight['TASK_ID']])) {
$arReaders[] = $arRight['GROUP_CODE'];
if ($bSocNet && preg_match('/^SG(\\d+)_[' . SONET_ROLES_OWNER . SONET_ROLES_MODERATOR . SONET_ROLES_USER . ']$/', $arRight['GROUP_CODE'], $matches)) {
$arReaders[] = "SG" . $matches[1];
}
}
}
} else {
$gr_res = CIBlock::GetGroupPermissions($iblockID);
foreach ($gr_res as $group_id => $perm) {
if ($perm >= 'R') {
$arReaders[] = 'G' . $group_id;
}
}
}
$readersCache[$ID] = array_unique($arReaders);
return $readersCache[$ID];
}
示例14: BeginNote
<td width="60%">
<input type="hidden" name="RIGHTS_MODE" value="S">
<input type="checkbox" id="RIGHTS_MODE" name="RIGHTS_MODE" value="E"><?php
echo BeginNote(), GetMessage("IB_E_RIGHTS_MODE_NOTE2"), EndNote();
?>
</td>
</tr>
<?php
if ($bWorkflow && $str_WORKFLOW == "Y") {
$arPermType = array("D" => GetMessage("IB_E_ACCESS_D"), "R" => GetMessage("IB_E_ACCESS_R"), "S" => GetMessage("IB_E_ACCESS_S"), "U" => GetMessage("IB_E_ACCESS_U"), "W" => GetMessage("IB_E_ACCESS_W"), "X" => GetMessage("IB_E_ACCESS_X"));
} elseif ($bBizprocTab) {
$arPermType = array("D" => GetMessage("IB_E_ACCESS_D"), "R" => GetMessage("IB_E_ACCESS_R"), "S" => GetMessage("IB_E_ACCESS_S"), "U" => GetMessage("IB_E_ACCESS_U2"), "W" => GetMessage("IB_E_ACCESS_W"), "X" => GetMessage("IB_E_ACCESS_X"));
} else {
$arPermType = array("D" => GetMessage("IB_E_ACCESS_D"), "R" => GetMessage("IB_E_ACCESS_R"), "S" => GetMessage("IB_E_ACCESS_S"), "T" => GetMessage("IB_E_ACCESS_T"), "W" => GetMessage("IB_E_ACCESS_W"), "X" => GetMessage("IB_E_ACCESS_X"));
}
$perm = CIBlock::GetGroupPermissions($ID);
if (!array_key_exists(1, $perm)) {
$perm[1] = "X";
}
?>
<tr class="heading">
<td colspan="2"><?php
echo GetMessage("IB_E_DEFAULT_ACCESS_TITLE");
?>
</td>
</tr>
<tr>
<td nowrap width="40%"><?php
echo GetMessage("IB_E_EVERYONE");
?>
[<a class="tablebodylink" href="/bitrix/admin/group_edit.php?ID=2&lang=<?php
示例15: ConvertEntity
public static function ConvertEntity($ownerType, $ownerId, $sectionId, $iblockId, $createdBy)
{
$eventsCount = 0;
$sectCount = 0;
$bs = new CIBlockSection();
$ent_id = "IBLOCK_" . $iblockId . "_SECTION";
$result = array('eventsCount' => 0, 'sectCount' => 0);
$bSetAccessFromCalendar = true;
$Access = array('G2' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_denied'));
// CONVERT ACCESS:
if ($ownerType == 'user') {
if (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_USER, $ownerId, "calendar")) {
return $result;
}
// Read
$read = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $ownerId, "calendar", 'view');
$taskId = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view');
if ($read == 'A') {
// All users
$Access['G2'] = $taskId;
} elseif ($read == 'C') {
// All autorized
$Access['AU'] = $taskId;
} elseif ($read == 'M' || $read == 'E') {
// Friends
$Access['SU' . $ownerId . '_F'] = $taskId;
} elseif ($bSetAccessFromCalendar) {
$bSetAccessFromCalendar = false;
}
// Write - will override read access
$write = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_USER, $ownerId, "calendar", 'write');
$taskId = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit');
if ($write == 'A') {
// All users
$Access['G2'] = $taskId;
} elseif ($write == 'C') {
// All autorized
$Access['AU'] = $taskId;
} elseif ($write == 'M' || $write == 'E') {
// Friends
$Access['SU' . $ownerId . '_F'] = $taskId;
}
} elseif ($ownerType == 'group') {
if (!CSocNetFeatures::IsActiveFeature(SONET_ENTITY_GROUP, $ownerId, "calendar")) {
return $result;
}
// Read
$read = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $ownerId, "calendar", 'view');
$taskId = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view');
if ($read == 'A') {
// Group owner
$Access['SG' . $ownerId . '_A'] = $taskId;
} elseif ($read == 'E') {
// Group moderator
$Access['SG' . $ownerId . '_E'] = $taskId;
} elseif ($read == 'K') {
// User
$Access['SG' . $ownerId . '_K'] = $taskId;
} elseif ($read == 'L') {
// Authorized
$Access['AU'] = $taskId;
} elseif ($read == 'N') {
// Authorized
$Access['G2'] = $taskId;
}
// Write - will override read access
$write = CSocNetFeaturesPerms::GetOperationPerm(SONET_ENTITY_GROUP, $ownerId, "calendar", 'write');
$taskId = CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit');
if ($write == 'A') {
// Group owner
$Access['SG' . $ownerId . '_A'] = $taskId;
} elseif ($write == 'E') {
// Group moderator
$Access['SG' . $ownerId . '_E'] = $taskId;
} elseif ($write == 'K') {
// User
$Access['SG' . $ownerId . '_K'] = $taskId;
} elseif ($write == 'L') {
// Authorized
$Access['AU'] = $taskId;
} elseif ($write == 'N') {
// Authorized
$Access['G2'] = $taskId;
}
} else {
$arGroupPerm = CIBlock::GetGroupPermissions($iblockId);
$taskByLetter = array('D' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_denied'), 'R' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_view'), 'W' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_edit'), 'X' => CCalendar::GetAccessTasksByName('calendar_section', 'calendar_access'));
foreach ($arGroupPerm as $groupId => $letter) {
$Access['G' . $groupId] = $taskByLetter[$letter];
}
}
// 1. Fetch sections
$arUserSections = CEventCalendar::GetCalendarList(array($iblockId, $sectionId, 0, $ownerType));
$calendarIndex = array();
foreach ($arUserSections as $section) {
$arUF = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields($ent_id, $section['ID']);
if (isset($arUF["UF_CAL_CONVERTED"]) && strlen($arUF["UF_CAL_CONVERTED"]['VALUE']) > 0) {
continue;
}
$SectionAccess = array();
//.........这里部分代码省略.........