Commit 3a95717f authored by Matija Obreza's avatar Matija Obreza

Genesys FTP

parent dbff36cf
......@@ -60,11 +60,11 @@ public class InstituteFilesServiceImpl implements InstituteFilesService {
private ImageGalleryService imageGalleryService;
private static final String getGalleriesPrefix(final FaoInstitute institute) {
return REPOSITORY_GALLERIES_PREFIX + institute.getCode() + "/acn/";
return REPOSITORY_GALLERIES_PREFIX + institute.getCode() + "/acn";
}
private static final String getGalleryPath(final FaoInstitute institute, final Accession accession) {
return getGalleriesPrefix(institute) + accession.getAccessionName() + "/";
return getGalleriesPrefix(institute) + "/" + accession.getAccessionName();
}
@Override
......
......@@ -66,7 +66,7 @@ public class RepositoryController extends BaseController {
private ImageGalleryService imageGalleryService;
@RequestMapping(value = "/files/**", method = RequestMethod.GET)
public String listAllFiles(HttpServletRequest request, ModelMap model) throws UnsupportedEncodingException {
public String listAllFiles(HttpServletRequest request, ModelMap model) throws UnsupportedEncodingException, InvalidRepositoryPathException {
String fullpath = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
fullpath = fullpath.substring(CONTROLLER_PATH.length() + "/files".length());
......@@ -77,7 +77,7 @@ public class RepositoryController extends BaseController {
}
@RequestMapping(value = "/files", method = RequestMethod.GET)
public String listAllFiles(@RequestParam(defaultValue = "/") String repositoryPath, ModelMap model) {
public String listAllFiles(@RequestParam(defaultValue = "/") String repositoryPath, ModelMap model) throws InvalidRepositoryPathException {
if (LOG.isDebugEnabled()) {
LOG.debug("Listing files for path=" + repositoryPath);
}
......
......@@ -32,6 +32,7 @@ import org.apache.ftpserver.usermanager.UsernamePasswordAuthentication;
import org.apache.ftpserver.usermanager.impl.AbstractUserManager;
import org.apache.ftpserver.usermanager.impl.ConcurrentLoginPermission;
import org.apache.ftpserver.usermanager.impl.WritePermission;
import org.genesys.blocks.security.lockout.AccountLockoutManager;
import org.genesys.filerepository.service.BytesStorageService;
import org.genesys.filerepository.service.ImageGalleryService;
import org.genesys.filerepository.service.RepositoryService;
......@@ -179,6 +180,9 @@ public class FileRepositoryConfig implements InitializingBean {
@Bean
public UserManager ftpUserManager() {
return new AbstractUserManager() {
@Autowired
private AccountLockoutManager lockoutManager;
private final Logger LOG = LoggerFactory.getLogger(this.getClass());
@Autowired
......@@ -238,8 +242,11 @@ public class FileRepositoryConfig implements InitializingBean {
if (!userService.checkPasswordsMatch(password, user.getFtpPassword())) {
// password mismatch
lockoutManager.handleFailedLogin(username);
throw new AuthenticationFailedException("Authentication failed");
} else {
lockoutManager.handleSuccessfulLogin(username);
LOG.info("FTP login successful for {}", username);
try {
return getUserByName(username);
} catch (FtpException e) {
......
......@@ -445,3 +445,11 @@ databaseChangeLog:
- dropColumn:
tableName: repositoryimage
columnName: createdBy
- changeSet:
id: 1506155384557-5
author: mobreza (generated)
changes:
- addAutoIncrement:
tableName: repositorygallery
columnName: id
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment