package org.crosswire.utils; import org.apache.log4j.Logger; import java.util.Properties; import java.util.HashMap; import javax.servlet.ServletContext; public class UserCredentials { static class CredentialsLoader { protected void loadCredentials(UserCredentials c) { } } private static CredentialsLoader cl = null; static private synchronized void loadCredentialsLoader() { if (cl == null) { /* String roleCheckURL = Utils.getSysConfig().getProperty("LiferayAPIBaseURL")+"/role/has-user-role"; String params = "userId="+userID + "&companyId="+Utils.getSysConfig(session).getProperty("LiferayCompanyDefault") + "&name="+java.net.URLEncoder.encode(role)+"&inherited=true"; StringBuffer result = HTTPUtils.postURL(roleCheckURL, params, Utils.getSysConfig(session).getProperty("LiferayAPIUser"), Utils.getSysConfig(session).getProperty("LiferayAPIPasswd")); boolean indexManager = "true".equals(result.toString().trim()); */ } } static private CredentialsLoader getCredentialsLoader() { if (cl == null) { loadCredentialsLoader(); } return cl; } private String userID; private HashMap perms = new HashMap(); public UserCredentials(String userID) { this.userID = userID; } static public UserCredentials retrieveCredentials(String userID) { UserCredentials c = new UserCredentials(userID); getCredentialsLoader().loadCredentials(c); return c; } boolean hasRole(String roleName) { return perms.get(roleName) != null; } int getAccessLevel(String accessLevelName) { return perms.get(accessLevelName)!=null?perms.get(accessLevelName):0; } }