Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
3a95717f
Commit
3a95717f
authored
Sep 24, 2017
by
Matija Obreza
Browse files
Genesys FTP
parent
dbff36cf
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/service/impl/InstituteFilesServiceImpl.java
View file @
3a95717f
...
...
@@ -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
...
...
src/main/java/org/genesys2/server/servlet/controller/admin/RepositoryController.java
View file @
3a95717f
...
...
@@ -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
);
}
...
...
src/main/java/org/genesys2/spring/config/FileRepositoryConfig.java
View file @
3a95717f
...
...
@@ -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
)
{
...
...
src/main/resources/liquibase/liquibase-changeLog.yml
View file @
3a95717f
...
...
@@ -445,3 +445,11 @@ databaseChangeLog:
-
dropColumn
:
tableName
:
repositoryimage
columnName
:
createdBy
-
changeSet
:
id
:
1506155384557-5
author
:
mobreza (generated)
changes
:
-
addAutoIncrement
:
tableName
:
repositorygallery
columnName
:
id
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment