From 9739aa18fda6f6ebdcac0f939a5ab5b5ad32cc00 Mon Sep 17 00:00:00 2001 From: Michael Wilson Date: Wed, 29 Oct 2014 11:21:35 +0100 Subject: -Löschen der Berechtigungen bei gelöschtem Image/Versanstaltung implementiert -Recht "LinkAllowed" wird jetzt korrekt gesetzt --- dozentenmodulserver/src/main/java/sql/SQL.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'dozentenmodulserver/src/main/java/sql') diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java index 3990bf4e..80b97623 100644 --- a/dozentenmodulserver/src/main/java/sql/SQL.java +++ b/dozentenmodulserver/src/main/java/sql/SQL.java @@ -839,16 +839,20 @@ public class SQL { Connection con = getConnection(); Statement stm = con.createStatement(); - stm.executeUpdate("DELETE FROM bwLehrpool.m_VLData_imageInfo where GUID_imageID = '" - + id + "' " + "AND imageVersion = '" + version + "';"); + //delete the image record + stm.executeUpdate("DELETE FROM bwLehrpool.m_VLData_imageInfo WHERE GUID_imageID = '"+ id + "' " + "AND imageVersion = '" + version + "';"); + //delete all permission records for this image + stm.executeUpdate("DELETE FROM bwLehrpool.pm_VLData_image WHERE GUID_imageID = '"+id+"';"); + + con.commit(); con.close(); return true; } catch (SQLException e) { // TODO Auto-generated catch block - log.info(new Date() + " - Failed to deleteImage."); + log.info(new Date() + " - Failed to deleteImage and permissions."); e.printStackTrace(); } @@ -928,15 +932,19 @@ public class SQL { try { Connection con = getConnection(); Statement stm = con.createStatement(); - stm.executeUpdate("DELETE FROM bwLehrpool.m_VLData_lecture WHERE lectureID = '" - + id + "';"); + + //delete the lecture record + stm.executeUpdate("DELETE FROM bwLehrpool.m_VLData_lecture WHERE lectureID = '" + id + "';"); + //delete all permission records for this lecture + stm.executeUpdate("DELETE FROM bwLehrpool.pm_VLData_lecture WHERE lectureID = '" + id + "';"); + con.commit(); con.close(); return true; } catch (SQLException e) { // TODO Auto-generated catch block - log.info(new Date() + " - Failed to deleteLecture."); + log.info(new Date() + " - Failed to deleteLecture and permissions."); e.printStackTrace(); } @@ -1497,7 +1505,7 @@ public class SQL { + "image_read, " + "image_write, " + "Image_admin, " + "link_allowed)" + "VALUES(" + "'" + uid + "'," + "'" + imageID + "'," + "1," + "'" + userID + "'," + isRead - + "," + isWrite + "," + isLinkAllowed + "," + isAdmin + "" + + "," + isWrite + "," + isAdmin + "," + isLinkAllowed + "" + ");"); con.commit(); con.close(); -- cgit v1.2.3-55-g7522