You are viewing the PKP Support Forum | PKP Home Wiki

Confused about plugin settings

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Confused about plugin settings

Postby mwood » Wed Oct 28, 2009 11:34 am

There seem to be several kinds of auth plugin settings. The ones described in the custom template (plugins/auth/foo/settings.tpl) seem to be stored serialize()d in the auth_sources table, and they're fed to getInstance(settings,authId) by AuthSourceDAO::getPlugin() but I haven't yet found out what circumstances cause that. At any rate, my getInstance isn't being called by anything I've tried so far. The plugin class constructor takes an array of settings as an argument, but I can't find any example in which the wrapper script (plugins/auth/foo/index.php) gives them. There's the plugin_settings table but auth plugins don't seem to use it. The Technical Reference doesn't seem to say much of anything about plugin settings, except that they are like journal settings, which I don't see described.

The authentication-source configuration page is working fine -- it offers the content of my template and I can see that my choices were recorded in auth_sources. But my plugin always receives an empty array when instantiated. (And no wonder: the wrapper passes an empty argument list to the constructor.) The LDAP plugin, OTOH, seems to get values in its settings[] from somewhere, and its wrapper is the same. (In fact IIRC I started by copying the LDAP plugin and ripping out all the LDAP-specific code.) What should I be reading to make sense of it all?

I'm currently hacking on 2.2.1 since that's what we're running just now.
Posts: 20
Joined: Thu Nov 01, 2007 8:06 am
Location: Indianapolis, Indiana, US

Re: Confused about plugin settings

Postby mcrider » Wed Nov 04, 2009 1:03 pm

Hi mwood,

The technical references are a bit out of date and probably don't go into too much depth on auth plugins, so your best way to get to know this code is to hack and observe.

As to where getPlugin is called, try grepping for $authDao->getPlugin throughout OJS, its called a few times, e.g. in Validation::login(). You might also try dumping backtraces in various parts of the LDAPAuthPlugin's execution and then doing the same for your own plugin to make sure its following the same path.

Just out of curiosity, what are you trying to authorize against, i.e. what is your plugin for?

Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Confused about plugin settings

Postby mwood » Mon Nov 09, 2009 3:16 pm

I'm trying to create an auth plugin for the (was Yale, then JASIG) Central Authentication System. (Or, rather, our local variant, but the code should be readily reusable.)

The more I study the OJS code, the more I'm convinced that auth plugins are not quite 'Plugin's and should have their own infrastructure. They aren't configured, instantiated, or used the same way as other plugin categories. I'd be pleased to see prominent warnings about that in the next rev. of the documentation.
Posts: 20
Joined: Thu Nov 01, 2007 8:06 am
Location: Indianapolis, Indiana, US

Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest