Commit d0792b79 authored by Robert Czechowski's avatar Robert Czechowski Committed by Robert Czechowski

Admin interface: Add buttons to delete users / groups / participations

parent 2126eade
......@@ -1272,17 +1272,17 @@ impl MedalConnection for Connection {
Some(group)
}
fn delete_user(&self, user_id: i32) -> () {
fn delete_user(&self, user_id: i32) {
let query = "DELETE FROM session
WHERE id = $1";
self.execute(query, &[&user_id]).unwrap();
}
fn delete_group(&self, group_id: i32) -> () {
fn delete_group(&self, group_id: i32) {
let query = "DELETE FROM usergroup
WHERE id = $1";
self.execute(query, &[&group_id]).unwrap();
}
fn delete_participation(&self, user_id: i32, contest_id: i32) -> () {
fn delete_participation(&self, user_id: i32, contest_id: i32) {
let query = "DELETE FROM submission
WHERE id IN (
SELECT id FROM submission
......
......@@ -116,9 +116,9 @@ pub trait MedalConnection {
fn get_groups_complete(&self, session_id: i32) -> Vec<Group>;
fn get_group_complete(&self, group_id: i32) -> Option<Group>;
fn delete_user(&self, user_id: i32) -> ();
fn delete_group(&self, group_id: i32) -> ();
fn delete_participation(&self, user_id: i32, contest_id: i32) -> ();
fn delete_user(&self, user_id: i32);
fn delete_group(&self, group_id: i32);
fn delete_participation(&self, user_id: i32, contest_id: i32);
fn get_search_users(&self,
_: (Option<i32>,
......
......@@ -1384,17 +1384,17 @@ impl MedalConnection for Connection {
Some(group)
}
fn delete_user(&self, user_id: i32) -> () {
fn delete_user(&self, user_id: i32) {
let query = "DELETE FROM session
WHERE id = $1";
self.execute(query, &[&user_id]).unwrap();
}
fn delete_group(&self, group_id: i32) -> () {
fn delete_group(&self, group_id: i32) {
let query = "DELETE FROM usergroup
WHERE id = $1";
self.execute(query, &[&group_id]).unwrap();
}
fn delete_participation(&self, user_id: i32, contest_id: i32) -> () {
fn delete_participation(&self, user_id: i32, contest_id: i32) {
let query = "DELETE FROM submission
WHERE id IN (
SELECT id FROM submission
......
......@@ -1384,17 +1384,17 @@ impl MedalConnection for Connection {
Some(group)
}
fn delete_user(&self, user_id: i32) -> () {
fn delete_user(&self, user_id: i32) {
let query = "DELETE FROM session
WHERE id = ?1";
self.execute(query, &[&user_id]).unwrap();
}
fn delete_group(&self, group_id: i32) -> () {
fn delete_group(&self, group_id: i32) {
let query = "DELETE FROM usergroup
WHERE id = ?1";
self.execute(query, &[&group_id]).unwrap();
}
fn delete_participation(&self, user_id: i32, contest_id: i32) -> () {
fn delete_participation(&self, user_id: i32, contest_id: i32) {
let query = "DELETE FROM submission
WHERE id IN (
SELECT id FROM submission
......
......@@ -26,3 +26,8 @@
</tr>
{{/each}}
</table>
<form action="" method="post">
<input type="hidden" name="csrf_token" value="{{csrf_token}}">
<input type="submit" value="Löschen!">
</form>
......@@ -21,3 +21,7 @@
{{/each}}
</ul>
<form action="" method="post">
<input type="hidden" name="csrf_token" value="{{csrf_token}}">
<input type="submit" value="Löschen!">
</form>
......@@ -44,3 +44,8 @@ Nachname: {{lastname}}<br>
<li><a href="/admin/user/{{ ../userid }}/{{ this.0 }}">{{this.0}}: {{this.1}}</a></li>
{{/each}}
</ul>
<form action="" method="post">
<input type="hidden" name="csrf_token" value="{{csrf_token}}">
<input type="submit" value="Löschen!">
</form>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment