From 61f569347476264e27db2b0b35f40a8e883501f7 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Thu, 18 Jul 2013 13:01:24 +0300 Subject: [PATCH] Admins can now delete other admins, but not themselves. --- application/controllers/yllapito.php | 2 +- application/views/yllapito/users_show.php | 28 +++++++++++++++++++---- assets/js/scripts.js | 4 ++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/application/controllers/yllapito.php b/application/controllers/yllapito.php index f16691a..a525236 100644 --- a/application/controllers/yllapito.php +++ b/application/controllers/yllapito.php @@ -151,7 +151,7 @@ class Yllapito extends CI_Controller redirect('yllapito/users/'.$redir); break; case 'delete': - $this->user->delete($user_id); + $this->users->delete($user_id); redirect('yllapito/users'); break; case 'save': diff --git a/application/views/yllapito/users_show.php b/application/views/yllapito/users_show.php index 6075618..4e8c405 100644 --- a/application/views/yllapito/users_show.php +++ b/application/views/yllapito/users_show.php @@ -1,4 +1,3 @@ - can_seeusers == "no") { +if ($user->can_modusers == "no") { ?>
- Sinulla ei ole oikeutta käyttäjien listaamiseen. + Sinulla ei ole oikeutta käyttäjien muokkaamiseen.
can_seeusers == "no") { - +
+
+
+

Poista käyttäjä

+
+
+ id == $userid) { ?> + Et voi poistaa itseäsi, hassu. + + ">Poista käyttäjä + +
+
+
+
+
diff --git a/assets/js/scripts.js b/assets/js/scripts.js index 8bc57d3..6171893 100644 --- a/assets/js/scripts.js +++ b/assets/js/scripts.js @@ -38,6 +38,10 @@ jQuery(document).ready(function($) { } }); + $('.deleteuser').on('click', function () { + return confirm('Oletko varma?'); + }); + // Provide zebra striping to our table $('table tbody tr:odd').addClass("zebra");