You are here: Foswiki>Tasks Web>Item14489 (20 Sep 2017, MichaelDaum)Edit Attach

Item14489: SolrPlugin access denied to BlogPostForm

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: SolrPlugin
Branches:
Reported By: UlrichLeodolter
Waiting For:
Last Change By: MichaelDaum
SolrPlugin does have problems to index BlogPosts created by BlogAddOn.

The following small patch catches the error and the indexer can continue, i was not able to figure why there is an access denied.

--- lib/Foswiki/Plugins/SolrPlugin/Index.pm.orig   2017-09-19 10:46:53.881000000 +0200
+++ lib/Foswiki/Plugins/SolrPlugin/Index.pm   2017-09-19 11:15:16.477000000 +0200
@@ -413,6 +413,10 @@
       # Form definition not found, ignore
       my $e = shift;
       $this->log("ERROR: can't read form definition for $formName");
+    }
+    catch Foswiki::AccessControlException with {
+      my $e = shift;
+      $this->log("ERROR: access denied to $formName");
     };
 
     $formName =~ s/\//\./g;

Steps to reproduce:

  • Install BlogAddOn
  • copy _BlogAddOn/*.txt to data/Sandbox
  • ./solrindex topic=Sandbox.BlogPostExample

-- UlrichLeodolter - 19 Sep 2017

There seems to be another problem here: any script called from the command line should have admin rights. Which Foswiki version are you using? Any non-standard user mapping or login manager installed?

-- MichaelDaum - 19 Sep 2017

Foswiki::LoginManager::TemplateLogin and LDAP (LdapNgPlugin, LdapContrib) is used for Authentication. I have installed Foswiki 2.1.4 and updated all plugins including SolrPlugin.

-- UlrichLeodolter - 19 Sep 2017

Please try the following:

  • create a topic such as Sandbox.UserinfoTest
  • add the text %USERINFO{format="username=$username, wikiname=$wikiname, isadmin=$isadmin"}%
  • call the topic from the command line: cd bin; ./view skin=text topic=Sandbox.UserinfoTest

It should identify the calling user as an admin. If that is not the case, try again after having set Foswiki::cfg{Register}{AllowLoginName} = 1;

-- MichaelDaum - 19 Sep 2017

$  cd bin; ./view skin=text topic=Sandbox.UserinfoTest
 username=AdminUser, wikiname=AdminUser, isadmin=false

after setting AllowLoginName=1

$  cd bin; ./view skin=text topic=Sandbox.UserinfoTest 
 username=admin, wikiname=AdminUser, isadmin=true

hmm ... but indexing fails also on PluginTestEmptyPlugin which is part of EmptyPlugin and uses PackageForm. None of these topics is restricted to AdminUser, everything can be accessed without authentication.

-- UlrichLeodolter - 19 Sep 2017

Okay. You have to set AllowLoginName. Otherwise LdapContrib does not work correctly.

-- MichaelDaum - 19 Sep 2017

I have AllowLoginName set but it still does not work without my patch.

$ ./solrindex topic=Sandbox.PluginTestEmptyPlugin
Indexing topic Sandbox.PluginTestEmptyPlugin
ERROR: can't read form definition for PackageForm

The ERROR message is printed from my catch (see initial comment).

-- UlrichLeodolter - 19 Sep 2017

Sorry, last message was wrong, ERROR was catched by the OopsException in Index.pm.

For now i am happy that indexing doesn't stop.

-- UlrichLeodolter - 19 Sep 2017

Yes, those errors you still see are due to the indexer runing into a topic it doesn't find the form for. This can happen from time to time on crappy data. The indexer simply ignores this data then, and continues as far as it can. So I guess we can make this a no-action-requried task.

-- MichaelDaum - 20 Sep 2017
 
Topic revision: r8 - 20 Sep 2017, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy