Personal tools
You are here: Home Documentation Issue Trackers uwosh.flash issue tracker Unable to install flash in COEHS: You are not allowed to access 'images' in this context

#8 — Unable to install flash in COEHS: You are not allowed to access 'images' in this context

State Resolved
Area Process
Issue type Bug
Severity Medium
Submitted by Joel Herron
Submitted on Dec 08, 2010
Responsible T. Kim Nguyen
Return to tracker
Last modified on Aug 29, 2011 by T. Kim Nguyen
when trying to install uwosh.flash on the coehs site on plone2 I get the following stack trace:

Traceback (innermost last):

Module ZPublisher.Publish, line 119, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 42, in call_object
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 584, in installProducts
Module Products.CMFQuickInstallerTool.QuickInstallerTool, line 521, in installProduct
__traceback_info__: ('uwosh.flash',)
Module Products.GenericSetup.tool, line 390, in runAllImportStepsFromProfile
__traceback_info__: profile-uwosh.flash:default
Module Products.GenericSetup.tool, line 1182, in _runImportStepsFromContext
Module Products.GenericSetup.tool, line 1093, in _doRunImportStep
__traceback_info__: uwosh.flash
Module uwosh.flash.exportimport, line 37, in import_various
Module Products.ZCatalog.CatalogBrains, line 86, in getObject
Module OFS.Traversable, line 301, in restrictedTraverse
Module OFS.Traversable, line 232, in unrestrictedTraverse
__traceback_info__: ([], 'images')
Unauthorized: You are not allowed to access 'images' in this context

the attempted install was done using my joeladmin account which should have permissions, but obviously that appears not to be the case.
Steps to reproduce:
attempt to install uwosh.flash on plone2 /sites1/coehs/
Added by T. Kim Nguyen on Dec 08, 2010 08:57 PM
Issue state: unconfirmedopen
Responsible manager: (UNASSIGNED)nguyen
The code in question where it fails is this:

   #reindex all multimedia types incase something has changed in the way indexing is done
   pc = site.portal_catalog

   for mediaObj in pc.searchResults(type_name="Multimedia"):
       mediaObj.getObject().reindexObject()

On the cloned Zope I wrapped a try/except around that reindexObject() call:

  #reindex all multimedia types incase something has changed in the way indexing is done
  pc = site.portal_catalog

  for mediaObj in pc.searchResults(type_name="Multimedia"):
      logger.info("about to reindex '%s'" % mediaObj.id)
      try:
          mediaObj.getObject().reindexObject()
      except:
          logger.warn("caught exception")
          import pdb;pdb.set_trace()
          throwaway = True
          logger.warn("continuing...")

and then ran it in the foreground. Basically, out of thousands of things it reindexes, only one causes the exception, and for some reason its security is set so that even as kimadmin I am unable to look at it, neither in code nor in the ZMI.

2010-12-08 19:26:31 INFO uwosh.flash.import_various about to reindex 'images'
2010-12-08 19:26:31 WARNING uwosh.flash.import_various caught exception
/UWO/Plone-3.1-01/lib/python2.4/site-packages/uwosh.flash-0.7rc3-py2.4.egg/uwosh/flash/exportimport.py(46)import_various()
-> throwaway = True
(Pdb) mediaObj
<Products.ZCatalog.Catalog.mybrains object at 0x2985d1b0>
(Pdb) mediaObj.absolute_url()
'http://plonedev.uwosh.edu:11080/sites1/coehs/portal_catalog'
(Pdb) m = mediaObj
(Pdb) m.getObject().absolute_url()
*** Unauthorized: You are not allowed to access 'images' in this context
(Pdb) m.getObject()
*** Unauthorized: You are not allowed to access 'images' in this context
(Pdb) dir(m)
['__add__', '__allow_access_to_unprotected_subobjects__', '__class__', '__cmp__', '__delattr__', '__delitem__', '__delslice__', '__dict__', '__doc__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__getstate__', '__hash__', '__implemented__', '__init__', '__len__', '__module__', '__mul__', '__new__', '__of__', '__providedBy__', '__provides__', '__record_schema__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__setstate__', '__str__', '__weakref__', '_unrestrictedGetObject', 'getObject', 'getPath', 'getRID', 'getURL', 'has_key']
(Pdb) m.__class__
<class 'Products.ZCatalog.Catalog.mybrains'>
(Pdb) m.getURL()
'http://plonedev.uwosh.edu:11080/[…]/images'
(Pdb)


It's an images folder that I think contains two images. The two images are visible.

http://www.uwosh.edu/coehs/Grants/economics/staff/

http://www.uwosh.edu/[…]/DWatts2.jpg

http://www.uwosh.edu/[…]/Image%20-%20Grunloh.JPG

but if you try to view the images folder:

http://www.uwosh.edu/coehs/Grants/economics/staff/images

you're asked to log in and even if I log in with a user that has Manager role, I get

Insufficient Privileges

I used the ZMI Ownership tab at one level above, ie.

http://www.uwosh.edu/coehs/Grants/economics/staff/manage

and took ownership of it from kimadmin to nguyen, figuring it might fix the problem, but then when I try to view that images folder I get this error:

Traceback (innermost last):
 Module ZPublisher.Publish, line 119, in publish
 Module ZPublisher.mapply, line 88, in mapply
 Module ZPublisher.Publish, line 42, in call_object
 Module Shared.DC.Scripts.Bindings, line 313, in __call__
 Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
 Module App.special_dtml, line 178, in _exec
 Module Shared.DC.Scripts.Bindings, line 327, in __render_with_namespace__
 Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
 Module App.special_dtml, line 178, in _exec
 Module DocumentTemplate.DT_Util, line 196, in eval
  - __traceback_info__: RESPONSE
 Module <string>, line 0, in ?
AttributeError: 'NoneType' object has no attribute 'setHeader'
Added by T. Kim Nguyen on Dec 09, 2010 11:35 AM
Issue state: openresolved
I patched the code in the production server and updated uwosh.flash in svn to match:

https://svn.it.uwosh.edu/trac/changeset/2448

The patch corrects the query that looks for objects that may require reindexing, and traps exceptions that might occur during reindexing.

This allowed the quickinstall to proceed. The offending images folder remains in the site. Deletion via python prompt does not work, but with a patch to PortalFolder.py (line 412) it is possible to copy and paste the images folder so that the new copy is fully functional.
You must log in to add a response