summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/sql/SQL.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodulserver/src/main/java/sql/SQL.java')
-rw-r--r--dozentenmodulserver/src/main/java/sql/SQL.java107
1 files changed, 100 insertions, 7 deletions
diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java
index 0b5765fa..cb9464eb 100644
--- a/dozentenmodulserver/src/main/java/sql/SQL.java
+++ b/dozentenmodulserver/src/main/java/sql/SQL.java
@@ -942,7 +942,7 @@ public class SQL {
return ret;
}
- public int setImageRights(String pk_person, String pk_image,int role ,int read, int write, int changePermission, int admin,int linkallowed) {
+ public int setImageRights(String pk_person, String pk_image,int role ,int read, int write, int admin,int linkallowed) {
@@ -951,7 +951,7 @@ public class SQL {
Statement stm = con.createStatement();
String uid = UUID.randomUUID().toString();
- stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_image`(`GUID`,`GUID_imageID`,`roleID`,`userID`,`image_read`,`image_write`,`image_admin`,`image_changePermission`,`link_allowed`)VALUES('"
+ stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_image`(`GUID`,`GUID_imageID`,`roleID`,`userID`,`image_read`,`image_write`,`image_admin`,`link_allowed`)VALUES('"
+ uid
+ "','"
+ pk_image
@@ -966,8 +966,6 @@ public class SQL {
+ "','"
+ admin
+ "','"
- + changePermission
- + "','"
+ linkallowed+ "');");
con.commit();
con.close();
@@ -1057,7 +1055,8 @@ public class SQL {
}
//get all users from HS OG -- temp, tb replaced by allUsers bwLehrpool
- public List<Person> getAllOGUsers(){
+ //does -NOT- return the user himself
+ public List<Person> getAllOtherSatelliteUsers(String userID){
Connection con=getConnection();
Statement stm=null;
ResultSet res = null;
@@ -1072,7 +1071,7 @@ public class SQL {
e.printStackTrace();
}
try {
- res = stm.executeQuery("SELECT userID, Nachname, Vorname FROM m_user ORDER BY Nachname ASC;");
+ res = stm.executeQuery("SELECT userID, Nachname, Vorname FROM m_user WHERE userID !='"+userID+"' ORDER BY Nachname ASC;");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -1096,7 +1095,101 @@ public class SQL {
}
+
+ public boolean updateImagePermissions(){
+ boolean success=true;
+
+ Connection con=getConnection();
+ Statement stm=null;
+ try {
+ stm = con.createStatement();
+ stm.executeQuery("");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return success;
+ }// end setImagePermissions()
+ public boolean deleteImagePermissions(){
+ boolean success=true;
+
+ Connection con=getConnection();
+ Statement stm=null;
+ try {
+ stm = con.createStatement();
+ stm.executeQuery("");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return success;
+ }// end setImagePermissions()
+
+ public boolean writeAdditionalImageRights(String imageID, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin){
+ boolean success= true;
+
+ String uid = UUID.randomUUID().toString();
+ Connection con=getConnection();
+ Statement stm=null;
+
+ try {
+ stm=con.createStatement();
+
+ log.info(new Date() + " - INSERT INTO pm_VLData_image (" +
+ "GUID, " +
+ "GUID_imageID, " +
+ "roleID, " +
+ "userID, " +
+ "image_read, " +
+ "image_write, " +
+ "Image_admin, " +
+ "link_allowed)" +
+ "VALUES(" +
+ "'"+uid+"'," +
+ "'"+imageID+"'," +
+ "1," +
+ "'"+userID+"'," +
+ isRead+"," +
+ isWrite+"," +
+ isLinkAllowed+"," +
+ isAdmin+"" +
+ ")");
+
+ stm.executeUpdate("INSERT INTO pm_VLData_image (" +
+ "GUID, " +
+ "GUID_imageID, " +
+ "roleID, " +
+ "userID, " +
+ "image_read, " +
+ "image_write, " +
+ "Image_admin, " +
+ "link_allowed)" +
+ "VALUES(" +
+ "'"+uid+"'," +
+ "'"+imageID+"'," +
+ "1," +
+ "'"+userID+"'," +
+ isRead+"," +
+ isWrite+"," +
+ isLinkAllowed+"," +
+ isAdmin+"" +
+ ");");
+ con.commit();
+ con.close();
+ log.info(new Date() + " - Written additional image rights.");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ log.info(new Date() + " - Failed to write additional image rights.");
+ }
+
+
+ return success;
+
+ }// end
-}
+}//end class