summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
diff options
context:
space:
mode:
authorSimon Rettberg2018-06-14 16:18:42 +0200
committerSimon Rettberg2018-06-14 16:18:42 +0200
commitade450e19527dbf377d945ca7bae7a145cf44196 (patch)
treeaa6098a0a6b907fd39b3ca7591b9fe8670b08567 /dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
parent[server] Don't wipe network shares if client didn't set field (diff)
downloadtutor-module-ade450e19527dbf377d945ca7bae7a145cf44196.tar.gz
tutor-module-ade450e19527dbf377d945ca7bae7a145cf44196.tar.xz
tutor-module-ade450e19527dbf377d945ca7bae7a145cf44196.zip
Add support for LDAP lecture filters
Diffstat (limited to 'dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java')
-rw-r--r--dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
index 32124899..701d435b 100644
--- a/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
+++ b/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/mappers/DbLecture.java
@@ -20,6 +20,7 @@ import org.openslx.bwlp.sat.thrift.cache.OperatingSystemList;
import org.openslx.bwlp.sat.util.Util;
import org.openslx.bwlp.sat.web.VmChooserEntryXml;
import org.openslx.bwlp.sat.web.VmChooserListXml;
+import org.openslx.bwlp.sat.web.XmlFilterEntry;
import org.openslx.bwlp.thrift.iface.LectureRead;
import org.openslx.bwlp.thrift.iface.LectureSummary;
import org.openslx.bwlp.thrift.iface.LectureWrite;
@@ -121,6 +122,9 @@ public class DbLecture {
if (lecture.isSetNetworkShares()) {
DbNetshare.writeNetworkShares(connection, lectureId, lecture.networkShares);
}
+ if (lecture.isSetLdapFilters()) {
+ DbLectureFilter.writeLdapFilters(connection, lectureId, lecture.ldapFilters);
+ }
connection.commit();
return lectureId;
} catch (SQLException e) {
@@ -145,6 +149,9 @@ public class DbLecture {
if (lecture.isSetNetworkShares()) {
DbNetshare.writeNetworkShares(connection, lectureId, lecture.networkShares);
}
+ if (lecture.isSetLdapFilters()) {
+ DbLectureFilter.writeLdapFilters(connection, lectureId, lecture.ldapFilters);
+ }
stmt.executeUpdate();
}
@@ -332,6 +339,7 @@ public class DbLecture {
User.setCombinedUserPermissions(lecture, user);
lecture.setLocationIds(DbLocation.getLectureLocations(connection, lectureId));
lecture.setNetworkShares(DbNetshare.getLectureNetshares(connection, lectureId));
+ lecture.setLdapFilters(DbLectureFilter.getLectureLdapFilters(connection, lectureId));
return lecture;
} catch (SQLException e) {
LOGGER.error("Query failed in DbLecture.getLectureDetails()", e);
@@ -507,12 +515,15 @@ public class DbLecture {
boolean isForThisLocation = rs.getString("loctest") != null;
if (!isForThisLocation && rs.getBoolean("islocationprivate"))
continue; // Is limited to location, and we're not in one of the required locations
+ String lectureId = rs.getString("lectureid");
boolean isTemplate = rs.getBoolean("istemplate");
int prio = 100;
+ // Get ldap filters
+ List<XmlFilterEntry> ldapFilters = DbLectureFilter.getFiltersXml(connection, lectureId);
list.add(new VmChooserEntryXml(rs.getString("filepath"), prio, "-",
- rs.getString("lecturename"), rs.getString("description"), rs.getString("lectureid"),
+ rs.getString("lecturename"), rs.getString("description"), lectureId,
rs.getString("virtid"), rs.getString("virtname"), rs.getString("virtoskeyword"),
- rs.getString("osname"), "", isForThisLocation, isTemplate));
+ rs.getString("osname"), "", isForThisLocation, isTemplate, ldapFilters));
}
return list;
} catch (SQLException e) {