Documentation

GetModuleRightList

array
CModule::GetModuleRightList()

The method returns an array describing a specialized schema of the module access permission distribution. This function is a method of class describing the specific module. If a module requires the specialized schema of access permission distribution, the CModule class of that module should implement this method. A situation is possible when a module supports the schema of access permission distribution (property MODULE_GROUP_RIGHTS="Y"), alike the standard one and the default schema is used. In this case, the array describing the default schema can be obtained using the CMain::GetDefaultRightList() function.

Note. The array describing the schema of the Kernel module access permission distribution can be obtained using the CMain::GetMainRightList()

Non-static method.

Parameters

No parameters.

See Also

Examples of use

<?
// display permissions of installed modules
$rs = CModule::GetList();
while ($ar = $rs->Fetch()) :
    $MID = $ar["ID"];
    if ($MID!="main") :
        include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/".$MID."/install/index.php");
        if (class_exists($MID)) :
            $obModule = new $MID;
            if ($obModule->MODULE_GROUP_RIGHTS=="Y") :
                if (method_exists($obModule, "GetModuleRightList"))
                    $arRights = call_user_method("GetModuleRightList",$obModule);
                else
                    $arRights = $APPLICATION->GetDefaultRightList();

                echo $MID.": ".SelectBoxFromArray("RIGHTS_MODULE_".$MID, $arRights, ${"RIGHTS_MODULE_".$MID}, "<by default>");
            endif;
        endif;
    else:
        $arRights = $APPLICATION->GetMainRightList();
        echo $MID.": ".SelectBoxFromArray("RIGHTS_MODULE_".$MID, $arRights, ${"RIGHTS_MODULE_".$MID}, "<by default>");
    endif;
endwhile;
?>


© «Bitrix24», 2001-2024