/** * @param int $headUserId * @param int $subUserId * @return bool */ public static function checkUserSubordination($headUserId, $subUserId) { if (CModule::IncludeModule('intranet')) { $headUserId = (int) $headUserId; $subUserId = (int) $subUserId; if ($headUserId && $subUserId) { $headDepts = (array) CIntranetUtils::GetSubordinateDepartments($headUserId, true); if (!empty($headDepts)) { $subDepts = (array) CIntranetUtils::GetUserDepartments($subUserId); return sizeof(array_intersect($headDepts, $subDepts)) > 0; } } } return false; }