class UserController(BaseController): def __init__(self): #super(BaseController,self).__init__() BaseController.__init__(self) #response.write('__init__'); if self._check_session(): self.model = UserModel(session['username'], session['password']) def EnableAccount(self): if not self._check_session(): return json.dumps(self.AuthErr) try: dn = request.params.get("dn", "") username = request.params.get("username", "") enable = request.params.get("enable", "yes").strip() if (self.model.isAuthenticate()): if (enable == "yes"): enable = True else: enable = False if (not self.model.EnableAccount(dn, username, enable)): raise Exception(self.model.LastErrorStr) else: raise Exception(self.model.LastErrorStr) except Exception, e: return json.dumps({'success': False, 'msg': e.message, 'num': 0}) #return json.dumps(self.successOK) return json.dumps({'success': True, 'enable': enable})
def __init__(self): #super(BaseController,self).__init__() BaseController.__init__(self) #response.write('__init__'); if self._check_session(): self.model = UserModel(session['username'], session['password'])