CAdvContract :: HaveRole: Bitrix method

      
<?php 
//  CAdvContract :: HaveRole()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:105

    
public static function HaveRole($role$USER_ID=false)
    {
        global 
$USER$APPLICATION;

        if(
$USER_ID === false && is_object($USER))
            
$USER_ID $USER->GetID();
        
$USER_ID intval($USER_ID);

        if (
$USER_ID>0)
        {
            if(
is_object($USER) && $USER_ID == $USER->GetID())
                
$arrGroups $USER->GetUserGroupArray();
            else
                
$arrGroups CUser::GetUserGroup($USER_ID);

            
$arRoles $APPLICATION->GetUserRoles("advertising"$arrGroups);
            if(
in_array($role$arRoles))
                return 
true;
        }
        return 
false;
    }