CBPHelper :: checkUserSubordination: Bitrix method

      
<?php 
//  CBPHelper :: checkUserSubordination()
//  /dist/bitrix/modules/bizproc/classes/general/helper.php:2339

    
public static function checkUserSubordination($headUserId$subUserId)
    {
        if (
CModule::IncludeModule('intranet'))
        {
            
$headUserId = (int)$headUserId;
            
$subUserId = (int)$subUserId;

            if (
$headUserId && $subUserId)
            {
                
$headDepts = (array) CIntranetUtils::GetSubordinateDepartments($headUserIdtrue);
                if (!empty(
$headDepts))
                {
                    
$subDepts = (array) CIntranetUtils::GetUserDepartments($subUserId);
                    return (
sizeof(array_intersect($headDepts$subDepts)) > 0);
                }
            }
        }
        return 
false;
    }