Add delete, new and revoke in list_users page
This commit is contained in:
parent
dbcc23a535
commit
32bb0163c1
@ -58,8 +58,14 @@ if ($n && $p[0] == SALT_ADMIN)
|
||||
case "certificate/":
|
||||
case "certificate/newca":
|
||||
case "certificate/newca/":
|
||||
case "certificate/newclient":
|
||||
case "certificate/newclient/":
|
||||
case "certificate/deleteca":
|
||||
case "certificate/deleteca/":
|
||||
case "certificate/revoke":
|
||||
case "certificate/revoke/":
|
||||
case "certificate/get":
|
||||
case "certificate/get/":
|
||||
$page = require("admin/certificate.php");
|
||||
break;
|
||||
|
||||
|
@ -55,11 +55,56 @@ if (!empty($p[2]))
|
||||
$dir = "$misc_dir/pki";
|
||||
remove_directory($dir);
|
||||
}
|
||||
elseif ($p[2] == "revoke")
|
||||
{
|
||||
$name = $_GET['name'];
|
||||
if (isset($name))
|
||||
{
|
||||
putenv("OPENSSL_CONF=$misc_dir/openssl.cnf");
|
||||
putenv("TOP_DIR=$misc_dir/pki");
|
||||
$output = shell_exec("$misc_dir/CA.sh -revoke $name");
|
||||
//TODO Check revocation failed
|
||||
Team::set_revoked(TRUE, $name);
|
||||
}
|
||||
}
|
||||
// Is new team
|
||||
elseif ($p[2] == "newclient")
|
||||
{
|
||||
$name = $_GET['name'];
|
||||
//TODO handle error
|
||||
//TODO check revoked attribute
|
||||
if (isset($name))
|
||||
{
|
||||
new_client($name, $misc_dir);
|
||||
Team::set_revoked(FALSE, $name);
|
||||
}
|
||||
}
|
||||
elseif ($p[2] == "get")
|
||||
{
|
||||
$name = $_GET['name'];
|
||||
if (isset($name))
|
||||
{
|
||||
$path = "$misc_dir/pki/pkcs/$name.p12";
|
||||
if (file_exists($path) && is_readable($path))
|
||||
{
|
||||
header("Content-Type: application/force-download");
|
||||
header("Content-Length: ".strval(filesize($path)));
|
||||
header("Content-Disposition: attachment; filename=\"$name.p12\"");
|
||||
readfile($path);
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($p[2] == "deleteca" || $p[2] == "newca")
|
||||
{
|
||||
header("Location: /".SALT_ADMIN."/");
|
||||
exit;
|
||||
}
|
||||
elseif ($p[2] == "revoke" || $p[2] == "newclient")
|
||||
{
|
||||
header("Location: /".SALT_ADMIN."/teams");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
<th>Membres</th>
|
||||
<th>Points</th>
|
||||
<th>Place</th>
|
||||
<th>Révoqué</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{if $teams}
|
||||
@ -19,6 +20,9 @@
|
||||
<td>
|
||||
{$t->id}<br>
|
||||
<a href="?delete={$t->id}"><span class="glyphicon glyphicon-trash"></span></a>
|
||||
<a href="/{$SALT_ADMIN}/certificate/revoke?name={$t->team_name}"><span class="glyphicon glyphicon-remove"></span></a>
|
||||
<a href="/{$SALT_ADMIN}/certificate/get?name={$t->team_name}"><span class="glyphicon glyphicon-download"></span></a>
|
||||
<a href="/{$SALT_ADMIN}/certificate/newclient?name={$t->team_name}"><span class="glyphicon glyphicon-plus"></span></a>
|
||||
</td>
|
||||
<td>{$t->team_name}</td>
|
||||
<td>{$t->slogan}</td>
|
||||
@ -29,6 +33,7 @@
|
||||
</ul></td>
|
||||
<td>{$t->get_pts()}</td>
|
||||
<td>{$t->get_rank()}</td>
|
||||
<td>{if $t->revoked}Oui{else}Non{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
|
Loading…
Reference in New Issue
Block a user