Opened 11 years ago

Closed 11 years ago

#1524 closed task (fixed)

Send messages as emails

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: minor Milestone: BASE 2.16
Component: core Version:
Keywords: Cc:

Description

Messages are usually created by BASE when a job is completed. Currently, they are only saved in the database and the user need to login to BASE to see the messages. It would be nice if BASE could send an email also.

We need:

  • Find a suitable api (http://commons.apache.org/email/ ??)
  • Add server configuration options for an outgoing mail server (if not configured no emails will be sent)
  • Add configuration options for each user.
  • Code for sending the emails.

Change History (6)

comment:1 Changed 11 years ago by Nicklas Nordborg

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:2 Changed 11 years ago by Nicklas Nordborg

Resolution: fixed
Status: assignedclosed

(In [5442]) Fixes #1524: Send messages as emails

comment:3 Changed 11 years ago by Nicklas Nordborg

Resolution: fixed
Status: closedreopened

The changes made to Job.sendMessage() prevents setting a job as ended (successfully or with an error) if the owning user is lacking CREATE permission for messages. Previously the message was created directly as a data-layer object, thereby bypassing the regular permission checks. Now we need to use a real Message object since it contains logic for sending the actual email. The result is an exception when the job is complete something like this:

14:06:00,688 ERROR Application:1775 - Can't change job status to DONE: Job[id=65; name=Creating normalized bioassay set: Normalized bioassay set (guest)]
net.sf.basedb.core.PermissionDeniedException: Permission denied: Not allowed to create Message[new; name=Job done: 'Creating normalized bioassay set: Normalized bioassay set (guest)']
        at net.sf.basedb.core.BasicItem.checkPermission(BasicItem.java:110)
        at net.sf.basedb.core.DbControl.saveItem(DbControl.java:878)
        at net.sf.basedb.core.Job.sendMessage(Job.java:1556)
        at net.sf.basedb.core.Job.doneOk(Job.java:1021)
        at net.sf.basedb.core.Job$ProgressReporterImpl.setEnded(Job.java:1756)
        at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:131)
        at net.sf.basedb.test.PluginUtil.executeJob(PluginUtil.java:145)
        at net.sf.basedb.test.roles.AnalysisTest.normalizeBioAssaySet(AnalysisTest.java:209)
        at net.sf.basedb.test.roles.AnalysisTest.run(AnalysisTest.java:101)
        at net.sf.basedb.test.roles.GuestTest.run(GuestTest.java:59)
        at net.sf.basedb.test.roles.Run.main(Run.java:76)
--Job ended successfully: 136498 spots normalized, 0 spots removed

The messages here are contradicting. The actual result is that no message is created and the job is left in executing status.

comment:4 Changed 11 years ago by Nicklas Nordborg

Status: reopenednew

But... it also turns out that the job has actually ended successfully and the changes it made have been stored in the database. It is just the final step that updates the job's status and sends a message that fails.

comment:5 Changed 11 years ago by Nicklas Nordborg

Status: newassigned

comment:6 Changed 11 years ago by Nicklas Nordborg

Resolution: fixed
Status: assignedclosed

(In [5453]) Fixes #1524: Send messages as emails

Added an internal flag indicating that the message is a message from the system which automatically adds CREATE permission.

Note: See TracTickets for help on using tickets.