Skip to content

Commit

Permalink
LDEV-4412: Audit log entries are created when lessons are removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
FionaMalikoff committed Sep 15, 2017
1 parent 3b11ae0 commit 2a0ac10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -405,5 +405,6 @@ tour.progress.email.configure.title =Schedule progress reports
tour.progress.email.confure.content =Set up the dates to automatically send emails with a summary of learners progress to all monitors for this lesson.
error.date.in.past =Selected date is in the past.


audit.lesson.removed =Lesson "{0}" ({1}) status changed to removed.
audit.lesson.removed.permanently =Lesson "{0}" ({1}) removed permanently.
#======= End labels: Exported 398 labels for en AU =====
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ public class MonitoringService implements IMonitoringService {
private static Logger log = Logger.getLogger(MonitoringService.class);

private static final String AUDIT_LESSON_CREATED_KEY = "audit.lesson.created";
private static final String AUDIT_LESSON_REMOVED_KEY = "audit.lesson.removed";
private static final String AUDIT_LESSON_REMOVED_PERMANENTLY_KEY = "audit.lesson.removed.permanently";

private ILessonDAO lessonDAO;

Expand Down Expand Up @@ -867,6 +869,9 @@ public void removeLesson(long lessonId, Integer userId) {
securityService.isLessonMonitor(lessonId, userId, "remove lesson", true);
Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId));
setLessonState(requestedLesson, Lesson.REMOVED_STATE);

writeAuditLog(MonitoringService.AUDIT_LESSON_REMOVED_KEY,
new Object[] { requestedLesson.getLessonName(), requestedLesson.getLessonId() });
}

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -937,6 +942,9 @@ public void removeLessonPermanently(long lessonId, Integer userId) {

// finally remove the learning design
lessonDAO.delete(learningDesign);

writeAuditLog(MonitoringService.AUDIT_LESSON_REMOVED_PERMANENTLY_KEY,
new Object[] { lesson.getLessonName(), lesson.getLessonId() });
}

@Override
Expand Down

0 comments on commit 2a0ac10

Please sign in to comment.