From 1451836469782a60c4f171282c68c317b8642170 Mon Sep 17 00:00:00 2001 From: donal72 <donal72> Date: Wed, 17 Jan 2007 14:13:19 +0000 Subject: [PATCH] Mnet: In auth config, show which hosts have mnet/auth configured --- auth/mnet/auth.php | 56 +++++++++++++++++++++++++++++++++++++++++++ auth/mnet/config.html | 25 ++++++++++++++++++- lang/en_utf8/auth.php | 2 ++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/auth/mnet/auth.php b/auth/mnet/auth.php index b02c74e2b7..a862cda2f7 100644 --- a/auth/mnet/auth.php +++ b/auth/mnet/auth.php @@ -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"; } diff --git a/auth/mnet/config.html b/auth/mnet/config.html index 432cc6aae1..f8728cac1d 100644 --- a/auth/mnet/config.html +++ b/auth/mnet/config.html @@ -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); diff --git a/lang/en_utf8/auth.php b/lang/en_utf8/auth.php index cb6871d5eb..8d95d01c46 100644 --- a/lang/en_utf8/auth.php +++ b/lang/en_utf8/auth.php @@ -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'; -- 2.39.5