From 1b5c737cd5775fe62e166138ab51f8d31dd49d29 Mon Sep 17 00:00:00 2001 From: kakwa Date: Tue, 23 Jun 2015 21:42:06 +0200 Subject: [PATCH] implementing deletion of a user --- ldapcherry/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index ac567e4..ad37efd 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -447,6 +447,14 @@ class LdapCherry(object): def _deleteuser(self, username): for b in self.backends: self.backends[b].del_user(username) + cherrypy.log.error( + msg = "User '" + username + "' deleted from backend '" + b + "'", + severity = logging.DEBUG + ) + cherrypy.log.error( + msg = "User '" + username + "' deleted", + severity = logging.INFO + ) @cherrypy.expose def signin(self): @@ -565,11 +573,13 @@ class LdapCherry(object): return self.temp_adduser.render(form=form, roles=roles, is_admin=is_admin, notification=notification) @cherrypy.expose - def delete(self, **params): + def delete(self, user): """ remove user page """ self._check_auth(must_admin=True) is_admin = self._check_admin() - pass + referer = cherrypy.request.headers['Referer'] + self._deleteuser(user) + raise cherrypy.HTTPRedirect(referer) @cherrypy.expose def modify(self, user=None, **params):