Mnet: In auth config, show which hosts have mnet/auth configured

This commit is contained in:
donal72 2007-01-17 14:13:19 +00:00
parent b1f627d9eb
commit 1451836469
3 changed files with 82 additions and 1 deletions

View File

@ -427,6 +427,62 @@ class auth_plugin_mnet
* @param array $page An object containing all the data for this page.
*/
function config_form($config, $err) {
global $CFG;
$query = "
SELECT
h.id,
h.name as hostname,
h.wwwroot,
h2idp.publish as idppublish,
h2idp.subscribe as idpsubscribe,
idp.name as idpname,
h2sp.publish as sppublish,
h2sp.subscribe as spsubscribe,
sp.name as spname
FROM
{$CFG->prefix}mnet_host h
LEFT JOIN
{$CFG->prefix}mnet_host2service h2idp
ON
(h.id = h2idp.hostid AND
(h2idp.publish = 1 OR
h2idp.subscribe = 1))
INNER JOIN
{$CFG->prefix}mnet_service idp
ON
(h2idp.serviceid = idp.id AND
idp.name = 'sso_idp')
LEFT JOIN
{$CFG->prefix}mnet_host2service h2sp
ON
(h.id = h2sp.hostid AND
(h2sp.publish = 1 OR
h2sp.subscribe = 1))
INNER JOIN
{$CFG->prefix}mnet_service sp
ON
(h2sp.serviceid = sp.id AND
sp.name = 'sso_sp')
WHERE
((h2idp.publish = 1 AND h2sp.subscribe = 1) OR
(h2sp.publish = 1 AND h2idp.subscribe = 1)) AND
h.id != {$CFG->mnet_localhost_id}
ORDER BY
h.name ASC";
$resultset = get_records_sql($query);
$id_providers = array();
$service_providers = array();
foreach($resultset as $hostservice) {
if(!empty($hostservice->idppublish) && !empty($hostservice->spsubscribe)) {
$service_providers[]= array('id' => $hostservice->id, 'name' => $hostservice->hostname, 'wwwroot' => $hostservice->wwwroot);
}
if(!empty($hostservice->idpsubscribe) && !empty($hostservice->sppublish)) {
$id_providers[]= array('id' => $hostservice->id, 'name' => $hostservice->hostname, 'wwwroot' => $hostservice->wwwroot);
}
}
include "config.html";
}

View File

@ -51,8 +51,31 @@ $yesno = array(get_string('no'), get_string('yes'));
?>
</td>
</tr>
<tr valign="top" class="required">
<td colspan="3"><?php print_string('auth_mnet_roamin', 'auth'); ?>: </td>
</tr>
<?php
foreach($id_providers as $host):
?>
<tr valign="top" class="required">
<td align="right"><?php echo $host['name']; ?>: </td>
<td colspan="2"><?php echo $host['wwwroot']; ?> </td>
</tr>
<?php
endforeach;
?>
<tr valign="top" class="required">
<td colspan="3"><?php print_string('auth_mnet_roamout', 'auth'); ?>: </td>
</tr>
<?php
foreach($service_providers as $host):
?>
<tr valign="top" class="required">
<td align="right"><?php echo $host['name']; ?>: </td>
<td colspan="2"><?php echo $host['wwwroot']; ?> </td>
</tr>
<?php
endforeach;
// global $user_fields;
// print_auth_lock_options('mnet', $user_fields, get_string('auth_fieldlocks_help', 'auth'), false, false);

View File

@ -192,6 +192,8 @@ $string['auth_manualtitle'] = 'Manual accounts only';
$string['auth_mnettitle'] = 'Moodle Network authentication';
$string['auth_mnetdescription'] = 'Users are authenticated according to the web of trust defined in your Moodle Network settings.';
$string['auth_mnet_rpc_negotiation_timeout'] = 'The timeout in seconds for authentication over the XMLRPC transport.';
$string['auth_mnet_roamout'] = 'Your users can roam out to these hosts';
$string['auth_mnet_roamin'] = 'These host\'s users can roam in to your site';
$string['auth_mnet_auto_add_remote_users'] = 'When set to Yes, a local user record is auto-created when a remote user logs in for the first time.';
$string['auto_add_remote_users'] = 'Auto add remote users';
$string['rpc_negotiation_timeout'] = 'RPC negotiation timeout';