summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java
diff options
context:
space:
mode:
authorMichael Wilson2014-10-23 10:09:20 +0200
committerMichael Wilson2014-10-23 10:09:20 +0200
commit0d4700863d3dcd54b51112238380a17feec853ba (patch)
treee7b008a726d327385ee2b8504a70a31815384468 /dozentenmodulserver/src/main/java
parentMerge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff)
downloadtutor-module-0d4700863d3dcd54b51112238380a17feec853ba.tar.gz
tutor-module-0d4700863d3dcd54b51112238380a17feec853ba.tar.xz
tutor-module-0d4700863d3dcd54b51112238380a17feec853ba.zip
-Rechtevergabe für Veranstaltungen vorbereitet
Diffstat (limited to 'dozentenmodulserver/src/main/java')
-rw-r--r--dozentenmodulserver/src/main/java/sql/SQL.java181
1 files changed, 110 insertions, 71 deletions
diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java
index 3bd672e6..20dad27e 100644
--- a/dozentenmodulserver/src/main/java/sql/SQL.java
+++ b/dozentenmodulserver/src/main/java/sql/SQL.java
@@ -1143,41 +1143,6 @@ public class SQL {
return ret;
}
- public int setImageRights(String pk_person, String pk_image, int role,
- int read, int write, int linkallowed, int admin) {
-
- try {
- Connection con = getConnection();
- 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`,`link_allowed`)VALUES('"
- + uid
- + "','"
- + pk_image
- + "','"
- + role
- + "','"
- + pk_person
- + "','"
- + read
- + "','"
- + write
- + "','"
- + admin
- + "','"
- + linkallowed + "');");
- con.commit();
- con.close();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- log.info(new Date() + " - Failed to setImageRights.");
- e.printStackTrace();
- }
- return 0;
-
- }
-
public int getRoleID(String role) {
try {
@@ -1199,40 +1164,6 @@ public class SQL {
return -1;
}
- public int setLectureRights(String pk_person, String pk_lecture, int role,
- int read, int write, int changePermission, int admin) {
-
- try {
- Connection con = getConnection();
- Statement stm = con.createStatement();
-
- String uid = UUID.randomUUID().toString();
- stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_lecture`(`GUID`,`lectureID`,`roleID`,`userID`,`rec_read`,`rec_write`,`rec_admin`,`rec_changePermission`)VALUES('"
- + uid
- + "','"
- + pk_lecture
- + "','"
- + role
- + "','"
- + pk_person
- + "','"
- + read
- + "','"
- + write
- + "','"
- + admin
- + "','" + changePermission + "');");
- con.commit();
- con.close();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- log.info(new Date() + " - Failed to setLectureRights.");
- e.printStackTrace();
- }
- return 0;
-
- }
-
public String getLectureID(String name) {
String id = null;
try {
@@ -1403,6 +1334,40 @@ public class SQL {
return success;
}// end setImagePermissions()
+ public int setImageRights(String pk_person, String pk_image, int role,
+ int read, int write, int linkallowed, int admin) {
+
+ try {
+ Connection con = getConnection();
+ 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`,`link_allowed`)VALUES('"
+ + uid
+ + "','"
+ + pk_image
+ + "','"
+ + role
+ + "','"
+ + pk_person
+ + "','"
+ + read
+ + "','"
+ + write
+ + "','"
+ + admin
+ + "','"
+ + linkallowed + "');");
+ con.commit();
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to setImageRights.");
+ e.printStackTrace();
+ }
+ return 0;
+ }// end setImageRights
+
public boolean writeAdditionalImageRights(String imageID, String userID,
boolean isRead, boolean isWrite, boolean isLinkAllowed,
boolean isAdmin) {
@@ -1438,10 +1403,84 @@ public class SQL {
e.printStackTrace();
log.info(new Date() + " - Failed to write additional image rights.");
}
-
return success;
+ }// end writeAdditionalImageRights
- }// end
+
+ public int setLectureRights(String pk_person, String pk_lecture, int role,
+ int read, int write, int changePermission, int admin) {
+
+ try {
+ Connection con = getConnection();
+ Statement stm = con.createStatement();
+
+ String uid = UUID.randomUUID().toString();
+ stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_lecture`(`GUID`,`lectureID`,`roleID`,`userID`,`rec_read`,`rec_write`,`rec_admin`,`rec_changePermission`)VALUES('"
+ + uid
+ + "','"
+ + pk_lecture
+ + "','"
+ + role
+ + "','"
+ + pk_person
+ + "','"
+ + read
+ + "','"
+ + write
+ + "','"
+ + admin
+ + "','" + changePermission + "');");
+ con.commit();
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ log.info(new Date() + " - Failed to setLectureRights.");
+ e.printStackTrace();
+ }
+ return 0;
+ } // end setLectureRights
+
+
+
+ public boolean writeAdditionalLectureRights(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 lecture rights.");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ log.info(new Date() + " - Failed to write additional lecture rights.");
+ }
+ return success;
+ }// end writeAdditionalLectureRights
+
+
public void deleteAllAdditionalImagePermissions(String imageID,
String userID) {