Changeset 7048


Ignore:
Timestamp:
Dec 15, 2015, 2:57:41 PM (6 years ago)
Author:
Nicklas Nordborg
Message:

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'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7-stable/src/plugins/core/net/sf/basedb/plugins/batchimport/AbstractItemImporter.java

    r6998 r7048  
    675675        // pick out items on which write permission is granted
    676676        List<I> writableItems = new ArrayList<I>();
    677         for (I i : items)
    678         {
    679           if (i.hasPermission(Permission.WRITE))
     677        if (updateExistingItems)
     678        {
     679          // Only check for WRITE permission if we are going to update
     680          for (I i : items)
    680681          {
    681             writableItems.add(i);
     682            if (i.hasPermission(Permission.WRITE))
     683            {
     684              writableItems.add(i);
     685            }
    682686          }
     687        }
     688        else
     689        {
     690          // Pretend we have WRITE permission; we handle the !updateExistingItems later
     691          writableItems.addAll(items);
    683692        }
    684693        if (writableItems.size() == 1)
Note: See TracChangeset for help on using the changeset viewer.