本文整理汇总了PHP中CIBlockRights::GetGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockRights::GetGroups方法的具体用法?PHP CIBlockRights::GetGroups怎么用?PHP CIBlockRights::GetGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockRights
的用法示例。
在下文中一共展示了CIBlockRights::GetGroups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: CIBlockRights
$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);
$arAvailGroups = array();
while ($arAcc = $db_acc->Fetch())
{
$strTmpCat.= "<category id=\"".$arAcc["ID"]."\"".(IntVal($arAcc["IBLOCK_SECTION_ID"])>0?" parentId=\"".$arAcc["IBLOCK_SECTION_ID"]."\"":"").">".yandex_text2xml($arAcc["NAME"], true)."</category>\n";
$arAvailGroups[] = IntVal($arAcc["ID"]);
}
示例3: 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;
}
示例4: 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;
}