Jarn / collective.solr

9 stars 1 forks source link

When Exclude user from allowedRolesAndUsers is set, Anonymous can't make search #13

Open naro opened 12 years ago

naro commented 12 years ago

If I set Exclude user from allowedRolesAndUsers in @@solr-controlpanel, anonymous search fails with:

...
  Module script, line 111, in queryCatalog
   - <FSPythonScript at /Plone/queryCatalog>
   - Line 111
  Module AccessControl.ZopeGuards, line 373, in guarded_apply
  Module AccessControl.ZopeGuards, line 395, in builtin_guarded_apply
  Module collective.indexing.monkey, line 84, in searchResults
  Module collective.solr.monkey, line 31, in searchResults
  Module collective.solr.dispatcher, line 43, in __call__
  Module collective.solr.dispatcher, line 87, in solrSearchResults
  Module collective.solr.mangler, line 136, in mangleQuery
TypeError: cannot concatenate 'str' and 'NoneType' objects

getSecurityManager().getUser() returns AnonymousUser and getSecurityManager().getUser().getId() returns None. Line: token = 'user$' + getSecurityManager().getUser().getId() fails on TypeError. value variable contains ['Anonymous'] so token should be 'Anonymous' as well.

naro commented 12 years ago

I've tried to fix it in https://github.com/naro/collective.solr/commit/91e847f5e1ae47c578278a4c543ec49aa88d7429 but I'm not sure if this is correct behavior of exclude_user flag. Please review.