Opened 16 years ago

Closed 16 years ago

#1132 closed defect (fixed)

Plug-ins fail to create sub-directory when "auto-share" functionality is enabled

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 2.8.3
Component: core Version:
Keywords: Cc:

Description

Here is an example stacktrace from the ZipFileUnpacker plug-in.

net.sf.basedb.core.PermissionDeniedException: Permission denied: Not allowed to read Project key[id=63]
at net.sf.basedb.core.BasicItem.checkPermission(BasicItem.java:112)
at net.sf.basedb.core.DbControl.getItem(DbControl.java:811)
at net.sf.basedb.core.SharedItem.getProjectKey(SharedItem.java:72)
at net.sf.basedb.core.ShareableUtil.copyPermissions(ShareableUtil.java:177)
at net.sf.basedb.core.Directory.getNew(Directory.java:104)
at net.sf.basedb.util.zip.ZipUnpacker.getDirectory(ZipUnpacker.java:173)
at net.sf.basedb.util.zip.ZipUnpacker.unpackZipFile(ZipUnpacker.java:114)
at net.sf.basedb.plugins.ZipFileUnpacker.unpack(ZipFileUnpacker.java:115)
at net.sf.basedb.util.zip.AbstractFileUnpacker.run(AbstractFileUnpacker.java:163)
at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:108)
at net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java:506)
at java.lang.Thread.run(Thread.java:619)

It can be a bit hard to reproduce this error, but the following steps hopefully helps:

  1. As admin or root, Create one user (U) and one project (P). Add U as a member to P.
  2. Create a directory (D). Enable the "Share new files and sub-directories automatically" option.
  3. Share D to P with at least USE permission.
  4. Log in as U and upload a zip file (Z). Do not unpack the zip file at this step.
  5. Select Z in the file manager and click on the "Run plugin" button.
  6. For the "Save in" parameter, select the the directory D.
  7. The plug-in fails when unpacking the zip file with a stack trace similar to the one above.

There are currently two possible workarounds:

  1. Disable the "Share new files and sub-directories automatically" option.
  2. Disable "Use permissions" for the plug-in

NOTE! The underlying problem is an incorrect implementation of the permission checks for ProjectKey:s and ItemKey:s. This affects all plug-ins that are accessing those items directly or in-directly. The second workaround should work for any plug-in which has this problem unless the plug-in needs elevated permissions. The first workaround only works for plug-ins that have problems when creating subdirectories.

NOTE! This ticket is the same problem as comment:ticket:1131:3

Change History (1)

comment:1 by Nicklas Nordborg, 16 years ago

Resolution: fixed
Status: newclosed

(In [4553]) Fixes #1132: Plug-ins fail to create sub-directory when "auto-share" functionality is enabled

Note: See TracTickets for help on using tickets.