Opened 9 years ago

Closed 9 years ago

#1978 closed defect (fixed)

Permission denied on existing when running batch importer in 'create' mode

Reported by: Nicklas Nordborg Owned by: everyone
Priority: minor Milestone: BASE 3.7
Component: coreplugins Version:
Keywords: Cc:

Description (last modified by Nicklas Nordborg)

There seems to be a problem with batch item importers that may result in a PermissionDeniedException when running the batch importer in 'create' mode. If the importer finds an existing item that the logged in user doesn't have write permission to it stops with an error:

net.sf.basedb.core.BaseException: Permission denied: Not allowed to write Physical bioassay[Name=Hybridization A.00h] on line 5 in file 'physicalbioassay_out.txt': Hybridization A.0...
  at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:720)
  at net.sf.basedb.plugins.AbstractFlatFileImporter.run(AbstractFlatFileImporter.java:451)
  at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:116)
  at net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java:572)
  at java.lang.Thread.run(Unknown Source)
Caused by: net.sf.basedb.core.PermissionDeniedException: Permission denied: Not allowed to write Physical bioassay[Name=Hybridization A.00h]
  at net.sf.basedb.plugins.batchimport.AbstractItemImporter.handleData(AbstractItemImporter.java:705)
  at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:685)
  ... 4 more

Write permission should not be required since the importer is not going to update the item. IT doesn't help to set the 'Item already exists' option to 'skip'.

This issue was found in the physical bioassay importer but since it happens in the generic base class (AbstractItemImporter) it is probably present in all batch item importers.

Change History (2)

comment:1 by Nicklas Nordborg, 9 years ago

Description: modified (diff)

comment:2 by Nicklas Nordborg, 9 years ago

Resolution: fixed
Status: newclosed

(In [7048]) Fixes #1978: Permission denied on existing when running batch importer in 'create' mode

Checks was made in "incorrect" order, but since the code is a bit complex and can't be re-arranged easily the best solution was to pretend we have write permission and let the code continue and then handle the update/no-update difference later. The 'Item already exists' option must be set to 'skip'.

Note: See TracTickets for help on using tickets.