From cd5069557c030e3b040e5f030c004c77e6afe12d Mon Sep 17 00:00:00 2001 From: kakwa Date: Mon, 29 Jun 2015 23:07:53 +0200 Subject: [PATCH] adding skeleton for ppolicy check --- ldapcherry/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 4f42331..523c554 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -378,6 +378,8 @@ class LdapCherry(object): severity = logging.INFO ) + self.ppolicy = None + except Exception as e: self._handle_exception(e) cherrypy.log.error( @@ -680,6 +682,13 @@ class LdapCherry(object): severity = logging.INFO ) + def _checkppolicy(self, password): + if self.ppolicy is None: + ret = { 'match': True, 'reason': 'No password Policy'} + else: + ret = self.ppolicy.check(password) + return ret + @cherrypy.expose def signin(self): """simple signin page @@ -755,6 +764,14 @@ class LdapCherry(object): attrs_list = self.attributes.get_search_attributes() return self.temp_searchuser.render(searchresult = res, attrs_list = attrs_list, is_admin=is_admin) + @cherrypy.expose + def checkppolicy(self, password): + """ search user page """ + self._check_auth(must_admin=False) + is_admin = self._check_admin() + ret = self._checkppolicy(password) + return json.dumps(ret, separators=(',',':')) + @cherrypy.expose def searchadmin(self, searchstring=None): """ search user page """