Commit c831eec4 authored by Donal McMullan's avatar Donal McMullan
Browse files

clear up has_config confusion for multiauth plugins

parent f83d7185
...@@ -49,8 +49,8 @@ if ($institution && $plugin) { ...@@ -49,8 +49,8 @@ if ($institution && $plugin) {
$classname = 'PluginAuth' . ucfirst(strtolower($plugin)); $classname = 'PluginAuth' . ucfirst(strtolower($plugin));
safe_require('auth', strtolower($plugin)); safe_require('auth', strtolower($plugin));
$has_config = call_static_method($classname, 'has_config'); $has_instance_config = call_static_method($classname, 'has_instance_config');
if (false == $has_config && $add) { if (false == $has_instance_config && $add) {
// We've been asked to add an instance of an auth plugin that has no // We've been asked to add an instance of an auth plugin that has no
// config options. We've been called by an AJAX request, so we just // config options. We've been called by an AJAX request, so we just
...@@ -77,7 +77,7 @@ if ($institution && $plugin) { ...@@ -77,7 +77,7 @@ if ($institution && $plugin) {
} }
$authclass = new $classname(); $authclass = new $classname();
$form = $authclass->get_config_options($institution, $instanceid); $form = $authclass->get_instance_config_options($institution, $instanceid);
$form['name'] = 'auth_config'; $form['name'] = 'auth_config';
$form['plugintype'] = 'auth'; $form['plugintype'] = 'auth';
$form['pluginname'] = strtolower($plugin); $form['pluginname'] = strtolower($plugin);
......
...@@ -35,7 +35,7 @@ class AuthImap extends Auth { ...@@ -35,7 +35,7 @@ class AuthImap extends Auth {
public function __construct($id = null) { public function __construct($id = null) {
$this->type = 'imap'; $this->type = 'imap';
$this->has_config = true; $this->has_instance_config = true;
$this->config['host'] = ''; $this->config['host'] = '';
$this->config['port'] = '143'; $this->config['port'] = '143';
...@@ -110,10 +110,18 @@ class PluginAuthImap extends PluginAuth { ...@@ -110,10 +110,18 @@ class PluginAuthImap extends PluginAuth {
private static $default_config = array('host'=>'', 'port'=>'143', 'protocol'=>'/imap','changepasswordurl'=>''); private static $default_config = array('host'=>'', 'port'=>'143', 'protocol'=>'/imap','changepasswordurl'=>'');
public static function has_config() { public static function has_config() {
return false;
}
public static function get_config_options() {
return array();
}
public static function has_instance_config() {
return true; return true;
} }
public static function get_config_options($institution, $instance = 0) { public static function get_instance_config_options($institution, $instance = 0) {
// TODO: put these strings in a lang file // TODO: put these strings in a lang file
$options['/imap'] = 'IMAP'; $options['/imap'] = 'IMAP';
$options['/imap/ssl'] = 'IMAP/SSL'; $options['/imap/ssl'] = 'IMAP/SSL';
......
...@@ -34,7 +34,7 @@ require_once(get_config('docroot') . 'auth/lib.php'); ...@@ -34,7 +34,7 @@ require_once(get_config('docroot') . 'auth/lib.php');
class AuthInternal extends Auth { class AuthInternal extends Auth {
public function __construct($id = null) { public function __construct($id = null) {
$this->has_config = false; $this->has_instance_config = false;
$this->type = 'internal'; $this->type = 'internal';
if (!empty($id)) { if (!empty($id)) {
return $this->init($id); return $this->init($id);
...@@ -191,6 +191,14 @@ class PluginAuthInternal extends PluginAuth { ...@@ -191,6 +191,14 @@ class PluginAuthInternal extends PluginAuth {
public static function get_config_options() { public static function get_config_options() {
return array(); return array();
} }
public static function has_instance_config() {
return false;
}
public static function get_instance_config_options() {
return array();
}
} }
?> ?>
\ No newline at end of file
...@@ -58,7 +58,7 @@ abstract class Auth { ...@@ -58,7 +58,7 @@ abstract class Auth {
protected $priority; protected $priority;
protected $authname; protected $authname;
protected $config; protected $config;
protected $has_config; protected $has_instance_config;
protected $type; protected $type;
protected $ready; protected $ready;
...@@ -98,7 +98,7 @@ abstract class Auth { ...@@ -98,7 +98,7 @@ abstract class Auth {
// Return now if the plugin type doesn't require any config // Return now if the plugin type doesn't require any config
// (e.g. internal) // (e.g. internal)
if ($this->has_config == false) { if ($this->has_instance_config == false) {
return true; return true;
} }
......
...@@ -47,7 +47,7 @@ class AuthXmlrpc extends Auth { ...@@ -47,7 +47,7 @@ class AuthXmlrpc extends Auth {
*/ */
public function __construct($id = null) { public function __construct($id = null) {
$this->has_config = true; $this->has_instance_config = true;
$this->type = 'xmlrpc'; $this->type = 'xmlrpc';
$this->config['wwwroot'] = ''; $this->config['wwwroot'] = '';
...@@ -359,10 +359,18 @@ class PluginAuthXmlrpc extends PluginAuth { ...@@ -359,10 +359,18 @@ class PluginAuthXmlrpc extends PluginAuth {
); );
public static function has_config() { public static function has_config() {
return false;
}
public static function get_config_options() {
return array();
}
public static function has_instance_config() {
return true; return true;
} }
public static function get_config_options($institution, $instance = 0) { public static function get_instance_config_options($institution, $instance = 0) {
$peer = new Peer(); $peer = new Peer();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment