I've got this:
UserProfile prof = getUserProfile(properties.CurrentUserId);
UserProfile toCheck = getUserProfile(anotherUsersId);
"prof" user must be on a higher or on the same level as "toCheck" user. If "toCheck" is on a lower level he/she must be on the same branch of the hierarchy tree. If they are on the same level, their manager must be the same.
Is there an easy way to check this?