Commit c831eec4 authored by Donal McMullan's avatar Donal McMullan

clear up has_config confusion for multiauth plugins

parent f83d7185
......@@ -49,8 +49,8 @@ if ($institution && $plugin) {
$classname = 'PluginAuth' . ucfirst(strtolower($plugin));
safe_require('auth', strtolower($plugin));
$has_config = call_static_method($classname, 'has_config');
if (false == $has_config && $add) {
$has_instance_config = call_static_method($classname, 'has_instance_config');
if (false == $has_instance_config && $add) {
// 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
......@@ -77,7 +77,7 @@ if ($institution && $plugin) {
}
$authclass = new $classname();
$form = $authclass->get_config_options($institution, $instanceid);
$form = $authclass->get_instance_config_options($institution, $instanceid);
$form['name'] = 'auth_config';
$form['plugintype'] = 'auth';
$form['pluginname'] = strtolower($plugin);
......
......@@ -35,7 +35,7 @@ class AuthImap extends Auth {
public function __construct($id = null) {
$this->type = 'imap';
$this->has_config = true;
$this->has_instance_config = true;
$this->config['host'] = '';
$this->config['port'] = '143';
......@@ -110,10 +110,18 @@ class PluginAuthImap extends PluginAuth {
private static $default_config = array('host'=>'', 'port'=>'143', 'protocol'=>'/imap','changepasswordurl'=>'');
public static function has_config() {
return false;
}
public static function get_config_options() {
return array();
}
public static function has_instance_config() {
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
$options['/imap'] = 'IMAP';
$options['/imap/ssl'] = 'IMAP/SSL';
......
......@@ -34,7 +34,7 @@ require_once(get_config('docroot') . 'auth/lib.php');
class AuthInternal extends Auth {
public function __construct($id = null) {
$this->has_config = false;
$this->has_instance_config = false;
$this->type = 'internal';
if (!empty($id)) {
return $this->init($id);
......@@ -191,6 +191,14 @@ class PluginAuthInternal extends PluginAuth {
public static function get_config_options() {
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 {
protected $priority;
protected $authname;
protected $config;
protected $has_config;
protected $has_instance_config;
protected $type;
protected $ready;
......@@ -98,7 +98,7 @@ abstract class Auth {
// Return now if the plugin type doesn't require any config
// (e.g. internal)
if ($this->has_config == false) {
if ($this->has_instance_config == false) {
return true;
}
......
......@@ -47,7 +47,7 @@ class AuthXmlrpc extends Auth {
*/
public function __construct($id = null) {
$this->has_config = true;
$this->has_instance_config = true;
$this->type = 'xmlrpc';
$this->config['wwwroot'] = '';
......@@ -359,10 +359,18 @@ class PluginAuthXmlrpc extends PluginAuth {
);
public static function has_config() {
return false;
}
public static function get_config_options() {
return array();
}
public static function has_instance_config() {
return true;
}
public static function get_config_options($institution, $instance = 0) {
public static function get_instance_config_options($institution, $instance = 0) {
$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