def save_user(cls, data): id = data.get_request_parameter("id") delete = data.get_request_parameter("delete", default=None) if delete is None: user = KMUser.get(id) user.set_data(data) user.save() else: KMUser.delete_by_id(id)
def admin_user_save(self): ''' admin user page :return: template ''' id = self.data.get_request_parameter("id") delete = self.data.get_request_parameter("delete", default=None) if delete is None: user = KMUser.get(id) user.set_data(self.data) user.save() else: KMUser.delete_by_id(id) self.result['menu_list'] = get_menu_list() self.result['users'] = KMUser.all()
def admin_user_save(self): ''' admin user page :return: template ''' id = self.data.get_request_parameter("id"); delete = self.data.get_request_parameter("delete", default=None); if delete is None: user = KMUser.get(id) user.set_data(self.data) user.save() else: KMUser.delete_by_id(id) self.result['menu_list'] = get_menu_list() self.result['users'] = KMUser.all()
def admin_user(self): ''' admin user page :return: template ''' self.result['menu_list'] = get_menu_list() self.result['users'] = KMUser.all()
def admin_user(self): ''' admin user page :return: template ''' self.result['menu_list'] = get_menu_list() self.result['users'] = KMUser.all()
def admin_user_save(self): ''' admin user page :return: template ''' KMUserAdmin.save_user(self.data) self.result['menu_list'] = get_menu_list() self.result['users'] = KMUser.all()
def admin_user_edit(self): ''' admin user page :return: template ''' id = self.data.get_request_parameter("km_user_edit_id"); self.result['menu_list'] = get_menu_list() self.result['user'] = KMUser.get(id)
def save_user(): """ Save the user. will save the json string in the following formats. Format: 'keyName':{"hoge":"fuga"} """ try: session = db_manager.get_session() for save_user in request.forms: json_data = json.loads(save_user.decode('utf-8')) for id in json_data: if json_data[id] == "": user_delete(id, session) # delete else: user = KMUser() user.user_id = json_data[id]['user_id'] user.name = json_data[id]["name"] user.password = json_data[id]["password"] user.mail_address = json_data[id]["mail_address"] user.group_id = json_data[id]["group_id"] user.role_id = json_data[id]["role_id"] user_update(user, session) finally: session.close()
def admin_user_edit(self): ''' admin user page :return: template ''' id = self.data.get_request_parameter("km_user_edit_id") self.result['menu_list'] = get_menu_list() self.result['user'] = KMUser.get(id) self.result['groups'] = KMGroup.all() self.result['roles'] = KMRole.all()
def wrapper(*args, **kwargs): user_id = get_value_to_session(request, 'user_id') if user_id is not None: user = KMUser.get(user_id) user_id = user.id role = KMRole(user_id) if check_target(request, role): return callback(*args, **kwargs) else: # TODO: 例外スロー時にエラー画面に遷移するようにする return "<p>Access is not allowed!</p>"
def get_model(): """ return the model. :return: """ return KMUser()
def get_user(cls, user_id): user = KMUser() user.password = bcrypt.hashpw(TEST_PASSWORD.encode(SETTINGS.CHARACTER_SET), bcrypt.gensalt()) return user
def get_user(cls, user_id): user = KMUser() user.password = bcrypt.hashpw( TEST_PASSWORD.encode(SETTINGS.CHARACTER_SET), bcrypt.gensalt()) return user