summaryrefslogtreecommitdiffstats
path: root/php/Attic/examples/sample-sp/admin_user.php
diff options
context:
space:
mode:
authorChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-23 16:00:54 +0000
committerChristophe Nowicki <cnowicki@easter-eggs.com>2004-09-23 16:00:54 +0000
commitf94170a65c5585a2c955d14360becd3e2ca98ac2 (patch)
tree925f029ba25f31676fa92ca40113660c6423c5b5 /php/Attic/examples/sample-sp/admin_user.php
parent662764422bbf1b01decc01d414a7ab9d0db63958 (diff)
downloadlasso-f94170a65c5585a2c955d14360becd3e2ca98ac2.tar.gz
lasso-f94170a65c5585a2c955d14360becd3e2ca98ac2.tar.xz
lasso-f94170a65c5585a2c955d14360becd3e2ca98ac2.zip
Group misc functions into misc.php on the idp and sp
Add Federation Terminaison metadata on the idp and sp Add view off federation on the sp Add cancel federation button on the sp and idp Defederation is not working yet
Diffstat (limited to 'php/Attic/examples/sample-sp/admin_user.php')
-rw-r--r--php/Attic/examples/sample-sp/admin_user.php53
1 files changed, 45 insertions, 8 deletions
diff --git a/php/Attic/examples/sample-sp/admin_user.php b/php/Attic/examples/sample-sp/admin_user.php
index 30efe3c6..48a903dd 100644
--- a/php/Attic/examples/sample-sp/admin_user.php
+++ b/php/Attic/examples/sample-sp/admin_user.php
@@ -24,13 +24,18 @@
$config = unserialize(file_get_contents('config.inc'));
+ require_once 'Log.php';
require_once 'DB.php';
-
-
+
+ // connect to the data base
$db = &DB::connect($config['dsn']);
-
if (DB::isError($db))
- die($db->getMessage());
+ die($db->getMessage());
+
+ // create logger
+ $conf['db'] = $db;
+ $logger = &Log::factory($config['log_handler'], 'log', $_SERVER['PHP_SELF'], $conf);
+
if (!empty($_GET['dump'])) {
$query = "SELECT identity_dump FROM users WHERE user_id=".$db->quoteSmart($_GET['dump']);
@@ -38,6 +43,7 @@
if (DB::isError($res))
print $res->getMessage(). "\n";
$row = $res->fetchRow();
+
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -78,6 +84,15 @@
die($res->getMessage());
}
+ lasso_init();
+
+ // Create Lasso Server
+ $server_dump = file_get_contents($config['server_dump_filename']);
+ $server = LassoServer::newFromDump($server_dump);
+
+ // Lasso User
+ $login = new LassoLogin($server);
+
$query = "SELECT * FROM users";
$res =& $db->query($query);
if (DB::isError($res))
@@ -107,7 +122,7 @@
<thead>
<tr align="center"><?php
for ($i = 0; $i < $num_col; $i++) {
- echo "<td>" . $tableinfo[$i]['name'] ."</td>";
+ echo "<td><b>" . $tableinfo[$i]['name'] ."</b></td>";
}
?><td>&nbsp;</td>
</tr>
@@ -127,6 +142,7 @@
{
case "identity_dump":
echo "<a href=javascript:openpopup('". $PHP_SELF . '?dump=' . $row[0] . "')>view</a>";
+ $identity_dump = $row[$i];
break;
default:
@@ -137,9 +153,29 @@
<?php
}
?>
- <td>
- <a href="<?php echo $PHP_SELF . '?del=' . $row[0]; ?>">delete</a>
- </td>
+ <td rowspan='2'><a href="<?php echo $PHP_SELF . '?del=' . $row[0]; ?>">delete</a></td>
+</tr>
+<tr>
+ <td colspan='<?php echo $num_col; ?>' align='center'>
+<?
+ // get all federations for this user
+ if (!empty($identity_dump))
+ {
+ $login->setIdentityFromDump($identity_dump);
+ $identity = $login->identity;
+ $providerIDs = $identity->providerIds;
+
+ for($i = 0; $i < $providerIDs->length() ; $i++)
+ {
+ if ($i)
+ echo "<br>";
+ echo $providerIDs->getItem($i);
+ }
+ }
+ else
+ echo "Not Federated with an Service Provider.";
+?>
+ </td>
</tr>
<?php
}
@@ -165,4 +201,5 @@
</html>
<?php
$db->disconnect();
+ lasso_shutdown();
?>