Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1097 → Rev 1098

/impl/src/java/pt/estgp/estgweb/domain/dao/impl/CourseUnitDaoImpl.java
234,13 → 234,17
 
public CourseUnit loadBySigesCodeUniqueMostRecent(String sigesCode, String courseCode, String semestre)
{
return (CourseUnit)
List<CourseUnit> cus =
createCriteria()
.add(eq("code", sigesCode))
.add(eq("courseCode", courseCode))
.add(eq("semestre", semestre))
.addOrder(Order.desc("importYear"))
.setMaxResults(1).list().get(0);
.setMaxResults(1).list();
if(cus.size() > 0)
return cus.get(0);
logger.warn("Accessing unit not existent with siges code " + sigesCode + " course code: " + courseCode + " semestre: " + semestre);
return null;
}
 
 
/impl/src/java/pt/estgp/estgweb/web/LayoutController.java
1,6 → 1,5
package pt.estgp.estgweb.web;
 
import jomm.utils.DesUtils;
import jomm.web.ftp.IFile;
import jomm.web.ftp.impl.FtpFile;
import jomm.web.utils.NavPlace;
12,8 → 11,6
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import pt.estgp.estgweb.domain.UserSession;
import pt.estgp.estgweb.domain.UserSessionImpl;
import pt.estgp.estgweb.services.ftpservices.FtpService;
import pt.estgp.estgweb.utils.ConfigProperties;
import pt.estgp.estgweb.web.controllers.ApplicationDispatchController;
import pt.estgp.estgweb.web.exceptions.NotAuthorizedException;
120,7 → 117,7
 
 
 
protected void processRequestFtp(HttpServletRequest request, HttpServletResponse response, String path, String serverStr, String server, String startPath)
protected void processRequestFtp(HttpServletRequest request, HttpServletResponse response, String path, String server, String serverUrl, String startPath)
throws ServletException, IOException
{
try
131,17 → 128,20
FtpManager.checkOperations(this,request,response);
 
UserSession userSession = UserSessionProxy.loadUserSessionFromRequest(request);
String username = userSession != null ? userSession.getUsername() : "UNKNOWN";
//String username = userSession != null ? userSession.getUsername() : "UNKNOWN";
 
FTPFileProxy.UserCredentialsForFtp u = FTPFileProxy.getUserCredentialsForFtp(server, userSession);
String username = u.username;
String password = u.password;
 
 
if (path != null)
{
 
boolean isStaticAccess = ConfigProperties.getBooleanProperty(serverStr+".use.default.credentials.to.updates.and.deletes");
String user;
String pass;
//boolean isStaticAccess = ConfigProperties.getBooleanProperty(serverStr+".use.default.credentials.to.updates.and.deletes");
//String user;
//String pass;
 
/*
if(isStaticAccess)
{
user = ConfigProperties.getProperty(serverStr + ".user");
155,8 → 155,9
pass= DesUtils.getInstance().decrypt(passwordCode);
//pass= ((UserImpl)userSession.getUser()).getPop3PassDecrypted();
}
FtpServer ftpServer = FtpServer.getNewServer(server, user, pass);
FTPClient client = ftpServer.getClient();
*/
FtpServer ftpServer = FtpServer.getNewServer(serverUrl, username, password);
FTPClient client = FTPFileProxy.getFtpClient(ftpServer,userSession,server,serverUrl);
if(client == null)
{
logger.warn("###################");
175,8 → 176,8
{
IFile iFile;
if (path.endsWith("/"))
iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path +ftpFile.getName(),"ISO-8859-1"), path);
else iFile = new FtpFile(ftpFile, server + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path);
iFile = new FtpFile(ftpFile, serverUrl + URIUtil.encodePath(path +ftpFile.getName(),"ISO-8859-1"), path);
else iFile = new FtpFile(ftpFile, serverUrl + URIUtil.encodePath(path + "/" + ftpFile.getName(),"ISO-8859-1"), path);
iFiles.add(iFile);
}
List<NavPlace> navPlaces = FtpFile.getNavPlaces(path,startPath);
187,7 → 188,7
}
else
{
throw new FileNotFoundException("url not found for server:" + server + " and path:" + path);
throw new FileNotFoundException("url not found for server:" + serverUrl + " and path:" + path);
}
}
catch (Throwable e)
/impl/src/java/pt/estgp/estgweb/web/FTPFileProxy.java
50,7 → 50,9
{
UserCredentialsForFtp u = new UserCredentialsForFtp();
boolean useDefaultCredentialsRead = ConfigProperties.getBooleanProperty(server + ".use.default.credentials.to.read");
String passwordUserInSessionCript = (String) ((UserSessionImpl)userSession).get(FtpService.FTP_PASSWORD);
String passwordUserInSessionCript = null;
if(userSession != null && ((UserSessionImpl)userSession).get(FtpService.FTP_PASSWORD) != null)
passwordUserInSessionCript = (String) ((UserSessionImpl)userSession).get(FtpService.FTP_PASSWORD);
 
if(!useDefaultCredentialsRead && // DEVE USAR AS DO USER
passwordUserInSessionCript != null && userSession.getUser() != null) // E ESTA AUTENTICADO