1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-25 18:54:29 +01:00

adding skeleton for ppolicy check

This commit is contained in:
kakwa 2015-06-29 23:07:53 +02:00
parent 721582304f
commit cd5069557c

View File

@ -378,6 +378,8 @@ class LdapCherry(object):
severity = logging.INFO severity = logging.INFO
) )
self.ppolicy = None
except Exception as e: except Exception as e:
self._handle_exception(e) self._handle_exception(e)
cherrypy.log.error( cherrypy.log.error(
@ -680,6 +682,13 @@ class LdapCherry(object):
severity = logging.INFO 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 @cherrypy.expose
def signin(self): def signin(self):
"""simple signin page """simple signin page
@ -755,6 +764,14 @@ class LdapCherry(object):
attrs_list = self.attributes.get_search_attributes() attrs_list = self.attributes.get_search_attributes()
return self.temp_searchuser.render(searchresult = res, attrs_list = attrs_list, is_admin=is_admin) 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 @cherrypy.expose
def searchadmin(self, searchstring=None): def searchadmin(self, searchstring=None):
""" search user page """ """ search user page """