<commit_before>package gov.nih.nci.cananolab.restful.util;

import gov.nih.nci.cananolab.service.security.UserBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;

public class SecurityUtil {
	
	private Logger logger = Logger.getLogger(SecurityUtil.class);
	
	public static String MSG_SESSION_INVALID = "User session invalid. Session may have been expired";
	
	public static boolean isUserLoggedIn(HttpServletRequest request) {
		if (request == null)
			return false;
		
		HttpSession session = request.getSession();
		if (session == null)
			return false;
		
		UserBean user = (UserBean) session.getAttribute("user");
		if (user == null)
			return false;
		
		return true;
	}
}
<commit_msg>isUserLoggedIn() now checks on user id<commit_after>package gov.nih.nci.cananolab.restful.util;

import gov.nih.nci.cananolab.service.security.UserBean;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;

public class SecurityUtil {
	
	private Logger logger = Logger.getLogger(SecurityUtil.class);
	
	public static String MSG_SESSION_INVALID = "User session invalid. Session may have been expired";
	
	public static boolean isUserLoggedIn(HttpServletRequest request) {
		if (request == null)
			return false;
		
		HttpSession session = request.getSession();
		if (session == null)
			return false;
		
		UserBean user = (UserBean) session.getAttribute("user");
		if (user == null || user.getUserId() == null || user.getUserId().length() == 0 )
			return false;
		
		return true;
	}
}

{'fraction_non_alphanumeric': 0.1047087980173482, 'fraction_numerical': 0.0018587360594795538, 'mean_word_length': 4.493197278911564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5047409', 'n_tokens_mistral': 536, 'n_tokens_neox': 482, 'n_words': 125}