]> git.mjollnir.org Git - moodle.git/commitdiff
Mnet: In auth config, show which hosts have mnet/auth configured
authordonal72 <donal72>
Wed, 17 Jan 2007 14:13:19 +0000 (14:13 +0000)
committerdonal72 <donal72>
Wed, 17 Jan 2007 14:13:19 +0000 (14:13 +0000)
auth/mnet/auth.php
auth/mnet/config.html
lang/en_utf8/auth.php

index b02c74e2b71c24b983f451f74af06bc83d6876d5..a862cda2f7a8733c217415199b8ead22f239cb91 100644 (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";
     }
 
index 432cc6aae115cf6823220c15f41fb661e7b576bc..f8728cac1d818453aaeb09ababc9f413483060e4 100644 (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);
index cb6871d5eb4c50f5ccfbbc5068a581a593c01cce..8d95d01c46356b92821a3c85cbdace4fa2be9ce7 100644 (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';