2020-06-08 10:56:38 +02:00
|
|
|
module.exports = socket => {
|
|
|
|
console.log("New connection !");
|
2020-11-02 17:22:50 +01:00
|
|
|
if (!socket.request.session.user) {
|
|
|
|
socket.on("login", require("./login")(socket));
|
|
|
|
socket.on("register", require("./register")(socket));
|
|
|
|
socket.on("checkResend", require("./email/checkResend")(socket));
|
|
|
|
socket.on("forgotPassword", require("./email/forgotPassword")(socket));
|
|
|
|
socket.on("setPassword", require("./email/setPassword")(socket));
|
|
|
|
} else {
|
|
|
|
socket.on("profileEdit", require("./profile/edit")(socket));
|
2020-11-03 12:54:40 +01:00
|
|
|
socket.on("logout", require("./logout")(socket));
|
2020-11-24 08:47:13 +01:00
|
|
|
socket.on("agendaGet", require("./get/agendaGet")(socket));
|
2020-12-12 22:49:09 +01:00
|
|
|
socket.on("gradeGet", require("./get/gradeGet")(socket));
|
|
|
|
if (socket.request.session.user.permissions > 1)
|
|
|
|
socket.on("evaluationGet", require("./get/evaluationGet")(socket));
|
2020-12-14 23:13:32 +01:00
|
|
|
if (socket.request.session.user.permissions > 2) {
|
|
|
|
socket.on("groupGet", require("./get/groupGet")(socket));
|
|
|
|
socket.on("semesterGet", require("./get/semesterGet")(socket));
|
2020-12-14 23:04:32 +01:00
|
|
|
socket.on("userSet", require("./set/userSet")(socket));
|
2020-12-14 23:13:32 +01:00
|
|
|
}
|
2020-11-02 17:22:50 +01:00
|
|
|
}
|
2020-06-08 10:56:38 +02:00
|
|
|
socket.emit("connected");
|
2020-11-24 08:47:13 +01:00
|
|
|
};
|