Remove WebGoat session object (#1929)
* refactor: modernize code * refactor: move to Tomcat * chore: bump to Spring Boot 3.3.3 * refactor: use Testcontainers to run integration tests * refactor: lesson/assignment progress * chore: format code * refactor: first step into removing base class for assignment Always been a bit of an ugly construction, as none of the dependencies are clear. The constructors are hidden due to autowiring the base class. This PR removes two of the fields. As a bonus we now wire the authentication principal directly in the controllers. * refactor: use authentication principal directly. * refactor: pass lesson to the endpoints No more need to get the current lesson set in a session. The lesson is now passed to the endpoints. * fix: Testcontainers cannot run on Windows host in Github actions. Since we have Windows specific paths let's run it standalone for now. We need to run these tests on Docker as well (for now disabled)
This commit is contained in:
@ -60,7 +60,6 @@ define(['jquery',
|
||||
this.lessonContentView.navToPage(pageNum);
|
||||
this.lessonHintView.hideHints();
|
||||
this.lessonHintView.showFirstHint();
|
||||
//this.lessonHintView.selectHints();
|
||||
this.titleView.render(this.lessonInfoModel.get('lessonTitle'));
|
||||
return;
|
||||
}
|
||||
@ -78,17 +77,11 @@ define(['jquery',
|
||||
};
|
||||
|
||||
this.onInfoLoaded = function() {
|
||||
this.helpControlsView = new HelpControlsView({
|
||||
hasPlan:this.lessonInfoModel.get('hasPlan'),
|
||||
hasSolution:this.lessonInfoModel.get('hasSolution'),
|
||||
hasSource:this.lessonInfoModel.get('hasSource')
|
||||
});
|
||||
|
||||
this.helpControlsView = new HelpControlsView();
|
||||
this.listenTo(this.helpControlsView,'hints:show',this.showHintsView);
|
||||
|
||||
this.listenTo(this.helpControlsView,'lesson:restart',this.restartLesson);
|
||||
|
||||
this.helpControlsView.render();
|
||||
|
||||
this.showHintsView();
|
||||
this.titleView.render(this.lessonInfoModel.get('lessonTitle'));
|
||||
};
|
||||
@ -98,7 +91,8 @@ define(['jquery',
|
||||
};
|
||||
|
||||
this.onContentLoaded = function(loadHelps) {
|
||||
this.lessonInfoModel = new LessonInfoModel();
|
||||
this.lessonInfoModel = new LessonInfoModel({'lesson':loadHelps['urlRoot']});
|
||||
|
||||
this.listenTo(this.lessonInfoModel,'info:loaded',this.onInfoLoaded);
|
||||
|
||||
if (loadHelps) {
|
||||
@ -126,6 +120,8 @@ define(['jquery',
|
||||
};
|
||||
|
||||
this.showHintsView = function() {
|
||||
var self=this;
|
||||
console.log(self.name);
|
||||
if (!this.lessonHintView) {
|
||||
this.createLessonHintView();
|
||||
}
|
||||
@ -141,7 +137,7 @@ define(['jquery',
|
||||
this.restartLesson = function() {
|
||||
var self=this;
|
||||
$.ajax({
|
||||
url:'service/restartlesson.mvc',
|
||||
url: 'service/restartlesson.mvc/' + encodeURIComponent(self.name),
|
||||
method:'GET'
|
||||
}).done(function(lessonLink) {
|
||||
self.loadLesson(self.name);
|
||||
|
@ -10,7 +10,7 @@ define(['jquery',
|
||||
return Backbone.Collection.extend({
|
||||
model: HintModel,
|
||||
url:'service/hint.mvc',
|
||||
initialize: function () {
|
||||
initialize: function (options) {
|
||||
var self = this;
|
||||
this.fetch().then(function (data) {
|
||||
this.models = data;
|
||||
|
@ -6,15 +6,15 @@ define(['jquery',
|
||||
Backbone){
|
||||
|
||||
return Backbone.Model.extend({
|
||||
url:'service/lessoninfo.mvc',
|
||||
url: function() { return 'service/lessoninfo.mvc/' + this.lesson; },
|
||||
|
||||
initialize: function (options) {
|
||||
this.lesson = options.lesson;
|
||||
this.fetch().then(this.infoLoaded.bind(this));
|
||||
},
|
||||
|
||||
infoLoaded: function(data) {
|
||||
this.trigger('info:loaded',this,data);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
@ -1,13 +1,20 @@
|
||||
define([
|
||||
'backbone',
|
||||
'goatApp/model/AssignmentStatusModel'
|
||||
],
|
||||
function(
|
||||
Backbone,
|
||||
AssignmentStatusModel) {
|
||||
return Backbone.Collection.extend({
|
||||
//tagName: 'ul',
|
||||
url: 'service/lessonoverview.mvc',
|
||||
model: AssignmentStatusModel
|
||||
});
|
||||
});
|
||||
'backbone',
|
||||
'goatApp/model/AssignmentStatusModel'
|
||||
],
|
||||
function (
|
||||
Backbone,
|
||||
AssignmentStatusModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url: function () {
|
||||
return 'service/lessonoverview.mvc/' + this.lesson;
|
||||
},
|
||||
|
||||
model: AssignmentStatusModel,
|
||||
|
||||
initialize: function (options) {
|
||||
//TODO: Not the best way to do this, but it works for now.
|
||||
this.lesson = options.baseLessonUrl.substring(options.baseLessonUrl.lastIndexOf('/') + 1);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -18,7 +18,6 @@ var goatConstants = {
|
||||
solutionService: 'service/solution.mvc',
|
||||
lessonPlanService: 'service/lessonplan.mvc',
|
||||
menuService: 'service/lessonmenu.mvc',
|
||||
lessonTitleService: 'service/lessontitle.mvc',
|
||||
restartLessonService: 'service/restartlesson.mvc'
|
||||
}
|
||||
},
|
||||
|
@ -14,7 +14,7 @@ define(['jquery',
|
||||
|
||||
initialize: function ($contentPages,baseLessonUrl,initPageNum) {
|
||||
this.$contentPages = $contentPages;
|
||||
this.collection = new LessonOverviewCollection();
|
||||
this.collection = new LessonOverviewCollection({baseLessonUrl: baseLessonUrl});
|
||||
this.listenTo(this.collection, 'reset', this.render);
|
||||
this.numPages = this.$contentPages.length;
|
||||
this.baseUrl = baseLessonUrl;
|
||||
@ -144,7 +144,7 @@ define(['jquery',
|
||||
|
||||
if (this.currentPage >= this.numPages -1) {
|
||||
this.hideNextPageButton();
|
||||
this.showPrevPageButton;
|
||||
this.showPrevPageButton();
|
||||
}
|
||||
this.collection.fetch({reset:true});
|
||||
},
|
||||
|
Reference in New Issue
Block a user