Hello, I'm not sure if this is the correct forum for my question. I'm running Zope 2.9.0 (though I've tried it on 2.8.5, with the same problem). I have a Python script in a Zope folder that checks a specified email address, packages all the emails and attachments, and adds them into a PloneArticle running on a Plone site. It finds the correct PloneArticle to add the item into, by doing a ZCatalog search (on the Plone portal_catalog). This works properly when I run the script myself. The user I run this as has the Manager role. I've set a proxy for the script so it runs as a Manager. However, when I set a ZopeScheduler to run this script, I get an error where the ZCatalog doesn't find any results when I search for the PloneArticle instance. Now the article I am searching for is catalogued, so I'm not sure why this is happening. This may be a problem with ZopeScheduler, or with Plone's catalog. Not sure which. Any assistance would be appreciated. Nick
Nicholas Watmough napisaĆ(a):
Hello,
I'm not sure if this is the correct forum for my question.
I'm running Zope 2.9.0 (though I've tried it on 2.8.5, with the same problem).
I have a Python script in a Zope folder that checks a specified email address, packages all the emails and attachments, and adds them into a PloneArticle running on a Plone site. It finds the correct PloneArticle to add the item into, by doing a ZCatalog search (on the Plone portal_catalog). This works properly when I run the script myself. The user I run this as has the Manager role.
I've set a proxy for the script so it runs as a Manager.
However, when I set a ZopeScheduler to run this script, I get an error where the ZCatalog doesn't find any results when I search for the PloneArticle instance. Now the article I am searching for is catalogued, so I'm not sure why this is happening.
This may be a problem with ZopeScheduler, or with Plone's catalog. Not sure which.
Any assistance would be appreciated.
Nick
Hi, The problem is with portal_catalog. See/apply this patch http://www.zope.org/Collectors/CMF/380 Pawel
Uhm, you sure this patch is a good idea? Why not use portal_catalog.unrestrictedSearchResults? Stefan On 17. Feb 2006, at 10:14, Pawel Lewicki wrote:
Hi, The problem is with portal_catalog. See/apply this patch http://www.zope.org/Collectors/CMF/380
Pawel
-- Anything that happens, happens. --Douglas Adams
On 2/17/06, Nicholas Watmough <nickw@deakin.edu.au> wrote:
I've set a proxy for the script so it runs as a Manager.
However, when I set a ZopeScheduler to run this script, I get an error where the ZCatalog doesn't find any results when I search for the PloneArticle instance. Now the article I am searching for is catalogued, so I'm not sure why this is happening.
This may be a problem with ZopeScheduler, or with Plone's catalog. Not sure which.
Any assistance would be appreciated.
The Catalog restricts it's results based on the current user rights, proxy roles do not play in that decision. Use unrestrictedSearchResults instead. -- Martijn Pieters
So my problem is that the user that is running the catalog search doesn't have sufficient permissions? That makes sense, though I had just thought there was a problem with my catalog. And unrestrictedSearchResults gets around this problem? Thanks, I'll have to try that. Martijn Pieters wrote:
On 2/17/06, Nicholas Watmough <nickw@deakin.edu.au> wrote:
I've set a proxy for the script so it runs as a Manager.
However, when I set a ZopeScheduler to run this script, I get an error where the ZCatalog doesn't find any results when I search for the PloneArticle instance. Now the article I am searching for is catalogued, so I'm not sure why this is happening.
This may be a problem with ZopeScheduler, or with Plone's catalog. Not sure which.
Any assistance would be appreciated.
The Catalog restricts it's results based on the current user rights, proxy roles do not play in that decision. Use unrestrictedSearchResults instead.
-- Martijn Pieters
I tried using unrestrictedSearchResults and got a security permission error, saying I didn't have permission to access unrestrictedSearchResults(). When I turned on verbose security, I got the following error: Unauthorized: The object is marked as private. Access to 'unrestrictedSearchResults' of (CatalogTool at /DCARF/project_file_system/portal_catalog) denied. How do I change the permissions so I can access this method? Thanks. Nick Martijn Pieters wrote:
On 2/17/06, Nicholas Watmough <nickw@deakin.edu.au> wrote:
I've set a proxy for the script so it runs as a Manager.
However, when I set a ZopeScheduler to run this script, I get an error where the ZCatalog doesn't find any results when I search for the PloneArticle instance. Now the article I am searching for is catalogued, so I'm not sure why this is happening.
This may be a problem with ZopeScheduler, or with Plone's catalog. Not sure which.
Any assistance would be appreciated.
The Catalog restricts it's results based on the current user rights, proxy roles do not play in that decision. Use unrestrictedSearchResults instead.
-- Martijn Pieters
On 2/19/06, Nicholas Watmough <nickw@deakin.edu.au> wrote:
I tried using unrestrictedSearchResults and got a security permission error, saying I didn't have permission to access unrestrictedSearchResults().
When I turned on verbose security, I got the following error:
Unauthorized: The object is marked as private. Access to 'unrestrictedSearchResults' of (CatalogTool at /DCARF/project_file_system/portal_catalog) denied.
How do I change the permissions so I can access this method?
You can't, but you can access the method from unrestricted code. Unrestricted code is any python code not stored in a Python Script or a Pagetemplate object. An External Method or a code part of a Zope Product would do the trick. -- Martijn Pieters
Thanks for that. It worked perfectly. Out of interest, why am I unable to access the method from with my Zope python code? What is a private object, and why is it private? Thanks, Nick Martijn Pieters wrote:
On 2/19/06, Nicholas Watmough <nickw@deakin.edu.au> wrote:
I tried using unrestrictedSearchResults and got a security permission error, saying I didn't have permission to access unrestrictedSearchResults().
When I turned on verbose security, I got the following error:
Unauthorized: The object is marked as private. Access to 'unrestrictedSearchResults' of (CatalogTool at /DCARF/project_file_system/portal_catalog) denied.
How do I change the permissions so I can access this method?
You can't, but you can access the method from unrestricted code. Unrestricted code is any python code not stored in a Python Script or a Pagetemplate object. An External Method or a code part of a Zope Product would do the trick.
-- Martijn Pieters
On 2/24/06, Nicholas Watmough <nickw@deakin.edu.au> wrote:
Out of interest, why am I unable to access the method from with my Zope python code? What is a private object, and why is it private?
All through-the-web code is run in a restricted sandbox; this includes Python Scripts, DTML methods, ZSQL methods and Page Templates. Any access to non-restricted code (Zope Products, the Zope framework itself, External Methods) is governed by the Zope security system, and the permissions set. 'Private' is the label given to code that cannot, ever, be directly called from restricted code. The method in question is private because it bypasses the security restrictions imposed by the regular version. -- Martijn Pieters
participants (4)
-
Martijn Pieters -
Nicholas Watmough -
Pawel Lewicki -
Stefan H. Holek