diff options
author | Björn Hagemeister | 2014-10-22 16:38:43 +0200 |
---|---|---|
committer | Björn Hagemeister | 2014-10-22 16:38:43 +0200 |
commit | b05ccce1ce7b428c36c754aa6673a2e08d0ba209 (patch) | |
tree | 23ecd1c4f47073fcad04f4b82c759eddc75661f4 /src | |
parent | Store publickey in DbSatellite with prefix mod: and exp: for better indicatin... (diff) | |
download | masterserver-b05ccce1ce7b428c36c754aa6673a2e08d0ba209.tar.gz masterserver-b05ccce1ce7b428c36c754aa6673a2e08d0ba209.tar.xz masterserver-b05ccce1ce7b428c36c754aa6673a2e08d0ba209.zip |
Fixed several things for successful up and download to satellite.
Diffstat (limited to 'src')
4 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/org/openslx/imagemaster/db/DbImage.java b/src/main/java/org/openslx/imagemaster/db/DbImage.java index 1c7ba16..bc4fa25 100644 --- a/src/main/java/org/openslx/imagemaster/db/DbImage.java +++ b/src/main/java/org/openslx/imagemaster/db/DbImage.java @@ -113,7 +113,7 @@ public class DbImage return MySQL .update( - "INSERT INTO image (uuid, revision, title, path, createtime, updatetime, ownerid, operatingsystem, isvalid, isdeleted, description, filesize, missingblocks) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", + "INSERT IGNORE INTO image (uuid, revision, title, path, createtime, updatetime, ownerid, operatingsystem, isvalid, isdeleted, description, filesize, missingblocks) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", imageData.uuid, imageData.revision, imageData.title, filepath, imageData.createTime, imageData.updateTime, owner, imageData.operatingSystem, imageData.isValid, diff --git a/src/main/java/org/openslx/imagemaster/db/DbUser.java b/src/main/java/org/openslx/imagemaster/db/DbUser.java index 23ee6d5..87febe1 100644 --- a/src/main/java/org/openslx/imagemaster/db/DbUser.java +++ b/src/main/java/org/openslx/imagemaster/db/DbUser.java @@ -85,8 +85,8 @@ public class DbUser extends User public static boolean insertOrUpdate(UserInfo userInfo) { log.debug( "Inserted user '" + userInfo.userId + "' into db." ); int ret = MySQL.update( - "INSERT INTO user (organizationid, firstname, lastname, email) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE organizationid=VALUES(organizationid), firstname=VALUES(firstname), lastname=VALUES(lastname), email=VALUES(email)", - userInfo.organizationId, userInfo.firstName, userInfo.lastName, userInfo.eMail ); + "INSERT INTO user (login, password, organizationid, firstname, lastname, email) VALUES (?, '', ?, ?, ?, ?) ON DUPLICATE KEY UPDATE organizationid=VALUES(organizationid), firstname=VALUES(firstname), lastname=VALUES(lastname), email=VALUES(email)", + userInfo.userId, userInfo.organizationId, userInfo.firstName, userInfo.lastName, userInfo.eMail ); return (ret != 0); } diff --git a/src/main/java/org/openslx/imagemaster/server/ApiServer.java b/src/main/java/org/openslx/imagemaster/server/ApiServer.java index 5a88e8d..ebd222e 100644 --- a/src/main/java/org/openslx/imagemaster/server/ApiServer.java +++ b/src/main/java/org/openslx/imagemaster/server/ApiServer.java @@ -176,7 +176,7 @@ public class ApiServer public static boolean publishUser( String serverSessionId, UserInfo user ) throws AuthorizationException { // Check session. - if ( SessionManager.getSessionFromSessionId( serverSessionId ) == null ) { + if ( ServerSessionManager.getSession( serverSessionId ) == null ) { throw new AuthorizationException( AuthorizationError.NOT_AUTHENTICATED, "Session ID not valid" ); } if ( DbUser.forLogin( user.userId ) == null ) { diff --git a/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java b/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java index 70ecbc7..1f41be8 100644 --- a/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java +++ b/src/main/java/org/openslx/imagemaster/serverconnection/ImageProcessor.java @@ -60,7 +60,7 @@ public class ImageProcessor if ( imageData.title == null || imageData.title.isEmpty() ) throw new ImageDataException( ImageDataError.INVALID_DATA, "Image name not set." ); if ( imageData.ownerLogin == null || !DbUser.exists( imageData.ownerLogin ) ) - throw new ImageDataException( ImageDataError.INVALID_DATA, "Invalid image owner." ); + throw new ImageDataException( ImageDataError.INVALID_DATA, "Invalid image owner: " + imageData.ownerLogin ); if ( !imageData.isSetOperatingSystem() ) throw new ImageDataException( ImageDataError.INVALID_DATA, "Content operating system not set." ); if ( imageData.fileSize <= 0 ) |