Fix bug DNN-4064: Filter the user's portal id to limit users in current portal, also fix a possible null reference in basic search.